We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
static.out
出题人在打包 docker image 时把 data/ 目录用 COPY 加入了 image 中,并且设置目录拥有者为 judger,目录的权限是 766。
data/
在 online_judge.py 中预期使用 os.makedir() 来设置 data 目录的权限为 700,但是 os.makedir() 不改变已存在的目录的权限,见 python 3.11 文档 os.makedirs。所以 runner 用户可以读取 data 中的内容。
online_judge.py
os.makedir()
data
而 static.out 是其他用户可读的。所以有下面的非预期解。
#include <stdio.h> #include <stdlib.h> // static_data_path char *sdata_input_path = "./data/static.in"; char *sdata_output_path = "./data/static.out"; const int LEN = 2048; int main() { char *lines[2]; size_t ns[2]; FILE *fp = fopen(sdata_output_path, "r"); if (fp == NULL) { printf("failed to read static output"); exit(1); } // read and show the 2 prime numbers. getline(&lines[0], &ns[0], fp); printf("%s", lines[0]); getline(&lines[1], &ns[0], fp); printf("%s", lines[1]); free(lines[0]); free(lines[1]); fclose(fp); return 0; }
The text was updated successfully, but these errors were encountered:
我说怎么这题和杯窗鹅影第一题做法一模一样(甚至代码改个文件名交上去就PASS了),完全不像HG的出题风格,原来是非预期解…… 然后成功把我带到按顺序输出的沟里了,代码糊完发现读不出dynamic一脸蒙圈0.0
Sorry, something went wrong.
No branches or pull requests
出题人在打包 docker image 时把
data/
目录用 COPY 加入了 image 中,并且设置目录拥有者为 judger,目录的权限是 766。在
online_judge.py
中预期使用os.makedir()
来设置data
目录的权限为 700,但是os.makedir()
不改变已存在的目录的权限,见 python 3.11 文档 os.makedirs。所以 runner 用户可以读取data
中的内容。而
static.out
是其他用户可读的。所以有下面的非预期解。The text was updated successfully, but these errors were encountered: