F.A.Qs
更新时间:2025-11-19 23:59:58 编辑:admin
Chinese Version
Q:编译器版本及编译运行参数
A:系统 Ubuntu Server 24.04. 参数如下
| C: | gcc Main.c -o Main -O2 -fmax-errors=10 -Wall -lm –static -std=c17 -DONLINE_JUDGE |
| C++: | g++ Main.cc -o Main -O2 -fno-asm -fmax-errors=10 -Wall -lm –static -std=c++17 -DONLINE_JUDGE |
| Java: | javac -J-Xms1024M -J-Xmx1024M -J-Xss64M
Main.java java -Xms1024M -Xmx<题目内存限制> -Xss64M Main |
Java、Python 有额外 2 秒和额外 512M 内存用于运行与评测.
- C/C++: gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
- Python: 3.10.12
- JAVA: openjdk 17.0.12
Q:输入输出的形式
A:输入为stdin(Standard Input),输出为stdout(Standard Output).
例如,你可以用C语言的scanf或C++的cin从stdin中读取数据,并使用C语言的printf或C++的cout向stdout输出.
评测机禁止程序进行读写文件等其它输入输出行为,此类行为都会得到“Runtime Error”的结果.
以“多组a b两个数求和直至文件末尾”为例:
C:
#include <stdio.h>
int main(){
int a,b;
while(scanf("%d %d",&a, &b) != EOF)
printf("%d\n",a+b);
return 0;
}C++:
#include <iostream>
using namespace std;
int main(){
int a,b;
while(cin >> a >> b)
cout << a+b << endl;
return 0;
}
Python:
#!/usr/bin/python3
import sys
for line in sys.stdin:
a, b = line.split()
print(int(a) + int(b))
Java:
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
int a, b;
while (cin.hasNext()){
a = cin.nextInt(); b = cin.nextInt();
System.out.println(a + b);
}
}
}Q:本地运行良好,为什么评测结果是Compile Error
A: GNU 与 MS-VC++存在一些差异,例如:
main返回值需要为int, 不能为void main.i在for(int i=0...){...}外部不再有效itoa不是ANSI函数.__int64不是ANSI,需要64位整数输入应使用long long.
Q:有哪些评测结果
A:全部评测结果:
- Accepted: 程序正确编译执行并通过了全部评测数据.
- Pending: 程序已录入数据库,正在等待评测.
- Pending Rejudge: 程序正在等待重测.
- Compiling: 程序正在被评测机编译.
- Presentation Error: 程序输出的答案逻辑正确,但格式没有与评测数据的输出完全一致,检查数据之间的空行、空格等符号与题目描述及样例输出是否有出入.
- Wrong Answer: 存在部分评测数据的结果与答案不一致.
- Time Limit Exceeded: 程序运行时间超出了题目限制.
- Memory Limit Exceeded: 程序运行需要的内存超出了题目限制.
- Output Limit Exceeded: 程序输出远远超出了评测数据答案的长度,通常为 3 倍以上,请检查程序逻辑,可能是输出了不正确的内容,或陷入死循环.
- Runtime Error: 程序运行错误,包括不限于以下情况:段错误、浮点异常、尝试读写禁止的内存区域、调用了禁止的函数等.
- Compile Error: 评测机无法编译你的程序,请检查语法,以及所用本地编译器与评测机编译器的版本差异.
English Version
Q:What is the compiler the judge is using and what are the compiler options?
A:The online judge system is running on Debian Linux. We are using GNU GCC/G++ for C/C++ compile, openjdk-17-jdk for Java. The compile options are:
| C: | gcc Main.c -o Main -O2 -fmax-errors=10 -Wall -lm –static -std=c17 -DONLINE_JUDGE |
| C++: | g++ Main.cc -o Main -O2 -fno-asm -fmax-errors=10 -Wall -lm –static -std=c++17 -DONLINE_JUDGE |
| Java: | javac -J-Xms1024M -J-Xmx1024M -J-Xss64M
Main.java java -Xms1024M -Xmx |
Java, Python have 2 more seconds and 512M more memory when running and judging.
- C/C++: gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
- Python: 3.10.12
- JAVA: openjdk 17.0.10
Q:Where is the input and the output?
A:Your program shall read input from
stdin(Standard Input) and write output to
stdout(Standard Output).For example,you can use
scanf in C or cin in C++ to read from
stdin,and use printf in C or cout in C++ to
write to stdout. User programs are not allowed to open and read
from/write to files, you will get a “Runtime Error” if you try to do
so.
Here is a sample solution for problem a+b using C++:
#include <iostream>
using namespace std;
int main(){
int a,b;
while(cin >> a >> b)
cout << a+b << endl;
return 0;
}
Here is a sample solution for problem 1000 using C:
#include <stdio.h>
int main(){
int a,b;
while(scanf("%d %d",&a, &b) != EOF)
printf("%d\n",a+b);
return 0;
}Here is a sample solution for problem 1000 using Python:
#!/usr/bin/python3
import sys
for line in sys.stdin:
a, b = line.split()
print(int(a) + int(b))
Here is a sample solution for problem 1000 using Java:
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
int a, b;
while (cin.hasNext()){
a = cin.nextInt(); b = cin.nextInt();
System.out.println(a + b);
}
}
}Q:Why did I get a Compile Error? It’s well done!
A:There are some differences between GNU and MS-VC++, such as:
mainmust be declared asint,void mainwill end up with a Compile Error.iis out of definition after block “for(int i=0...){...}”itoais not an ANSI function.__int64ofVCis notANSI, but you can uselong longfor 64-bit integer. try use#define __int64 long longwhen submit codes fromMSVC6.0.
Q:What is the meaning of the judge’s reply XXXXX?
A:Here is a list of the judge’s replies and their meaning:
Pending: The judge is so busy that it can`t judge your submit at the moment, usually you just need to wait a minute and your submit will be judged.
Pending Rejudge: The test datas has been updated, and the submit will be judged again and all of these submission was waiting for the Rejudge.
Compiling: The judge is compiling your source code. Running & Judging: Your code is running and being judging by our Online Judge. Accepted : OK! Your program is correct!.
Presentation Error: Your output format is not exactly the same as the judge’s output, although your answer to the problem is correct. Check your output for spaces, blank lines,etc against the problem output specification.
Wrong Answer: Correct solution not reached for the inputs. The inputs and outputs that we use to test the programs are not public (it is recomendable to get accustomed to a true contest dynamic ;-).
Time Limit Exceeded: Your program tried to run during too much time.
Memory Limit Exceeded: Your program tried to use more memory than the judge default settings.
Output Limit Exceeded: Your program tried to write too much information. This usually occurs if it goes into a infinite loop.
Runtime Error: All the other Error on the running
phrase will get Runtime Error, such as
segmentation fault,floating point exception,
used forbidden functions,
tried to access forbidden memories and so on.
Compile Error: The compiler (gcc/g++/gpc) could not compile your ANSI program. Of course, warning messages are not error messages. Click the link at the judge reply to see the actual error message.
Q:How to attend Online Contests?
A:Can you submit programs for any practice problems on this Online Judge? If you can, then that is the account you use in an online contest. If you can`t, then please register an id with password first.
