수정 내역
- 7월 31일: Python tensorflow, torch, C++26, Rust nightly 추가. Rust 1.85 → 1.88 업데이트
코드 작성시 디버깅과 편의를 위해 로컬 컴퓨터의 개발 도구를 사용할 수 있습니다.
이 경우 로컬 컴퓨터에서의 개발 환경과 채점에서의 개발 환경이 달라 실행이나 채점이 되지 않는 불이익이 없도록 본 안내를 꼭 읽어보시기 바랍니다 (특히 Visual Studio / Visual C++ 사용시).
채점 환경
코드 제출 문제에 제출된 모든 코드의 실행과 채점은 다음 환경에서 이루어집니다.
- Amazon Web Services의 c7i.4xlarge 인스턴스
- Intel Xeon 4세대 기반 커스텀 프로세서
- 클럭: 3.2 GHz
- 프로세서 아키텍쳐: 64 bit
- OS: Ubuntu 24.04
해당 환경에서 동작하지 않는 코드는 채점이 되지 않습니다. 유념하여 개발 도구를 사용해주시기 바랍니다.
언어별 컴파일러
C20
c20
c20
gcc 13.3.0 (예시 코드)
사용 가능 외부 라이브러리
(없음)
컴파일 명령어
gcc -std=gnu2x -O2 -DONLINE_JUDGE -DNYPC -Wall -Wextra -march=native -mtune=native -o main main.c -lm실행 명령어
./main NYPCC++20
cpp20
cpp20
gcc 13.3.0 (예시 코드)
사용 가능 외부 라이브러리
컴파일 명령어
g++ -std=gnu++20 -O2 -DONLINE_JUDGE -DNYPC -Wall -Wextra -march=native -mtune=native -o main main.cpp -I/opt/boost/gcc/include -L/opt/boost/gcc/lib실행 명령어
./main NYPCPython3
python3
python3
Python 3.12.3 (예시 코드)
사용 가능 외부 라이브러리
컴파일 명령어
python3 -m py_compile main.py실행 명령어
python3 __pycache__/main.cpython-312.pyc NYPCPypy3
pypy3
pypy3
Python 3.9.18 (Pypy 7.3.15) (예시 코드)
사용 가능 외부 라이브러리
컴파일 명령어
pypy3 -m py_compile main.py실행 명령어
pypy3 __pycache__/main.pypy39.pyc NYPCJava 21
java21
java21
openjdk 21.0.7 (예시 코드)
사용 가능 외부 라이브러리
(없음)
컴파일 명령어
javac --release 21 -encoding UTF-8 Main.java -d out && jar cfe Main.jar Main -C out .실행 명령어
java -Xms<memory> -XmX<memory> -DONLINE_JUDGE=1 -DNYPC=1 -jar Main.jar NYPCRust 2024
rust2024
rust2024
rustc 1.88.0 (예시 코드)
사용 가능 외부 라이브러리
컴파일 명령어
cargo rustc -r -q --frozen -- -Copt-level=3 -Ctarget-cpu=native --cfg online_judge --cfg nypc실행 명령어
./target/release/main NYPCNode.js
nodejs22
nodejs22
Typescript 5.8.3
nodets22
nodets22
Typescript 5.8.3 (Node.js v22.13.1) (예시 코드)
사용 가능 외부 라이브러리
컴파일 명령어
tsc main.ts --target ESNext --moduleResolution node --module commonjs --noEmitOnError실행 명령어
node main.js NYPCC# 9
csharp9
csharp9
dotnet 9.0.104 (예시 코드)
사용 가능 외부 라이브러리
컴파일 명령어
dotnet publish -r linux-x64 -p:PublishSingleFile=true -p:DefineConstants="ONLINE_JUDGE;NYPC" --no-restore -c Release --sc true실행 명령어
./bin/Release/net9.0/linux-x64/publish/Main NYPCGo
golang124
golang124
LuaJIT
luajit
luajit
Lua 5.1 (LuaJIT 2.1.1748459687) (예시 코드)
사용 가능 외부 라이브러리
(없음)
컴파일 명령어
luajit -O3 -b Main.lua Main.out실행 명령어
/usr/local/bin/luajit Main.out NYPCLua 5.4
lua
lua
Lua 5.4.6 (예시 코드)
사용 가능 외부 라이브러리
(없음)
컴파일 명령어
/usr/bin/luac5.4 -o Main.out Main.lua실행 명령어
lua5.4 Main.out NYPCKotlin JVM 2.1
kotlinjvm
kotlinjvm
kotlinc-jvm 2.1.21 (예시 코드)
사용 가능 외부 라이브러리
(없음)
컴파일 명령어
kotlinc -include-runtime -d Main.jar Main.kt실행 명령어
java -Xms<memory> -XmX<memory> -DONLINE_JUDGE=1 -DNYPC=1 -jar Main.jar NYPCKotlin/Native 2.1
kotlinnative
kotlinnative
kotlinc-native 2.1.21 (예시 코드)
사용 가능 외부 라이브러리
(없음)
컴파일 명령어
konanc Main.kt -o Main -opt실행 명령어
./Main.kexe NYPCC++26
cpp-exp
cpp-exp
gcc 15
사용 가능 외부 라이브러리
컴파일 명령어
g++-15 -std=gnu++26 -O2 -DONLINE_JUDGE -DNYPC -Wall -Wextra -march=native -mtune=native -o main main.cpp -I/opt/boost/gcc/include -L/opt/boost/gcc/lib실행 명령어
./main NYPCRust 2024 Nightly
rust-exp
rust-exp
rustc >=1.90.0
사용 가능 외부 라이브러리
컴파일 명령어
cargo rustc -r -q --frozen -- -Copt-level=3 -Ctarget-cpu=native --cfg online_judge --cfg nypc실행 명령어
./target/release/main NYPC- 각 문제에서 시간과 메모리 제한은 C/C++ 기준으로 책정됩니다.
- 그 이외의 언어에서는 시간과 메모리를 더 쓸 수 있도록 허용되는 경우가 있지만, 모든 문제를 모든 언어로 해결할 수 있다는 보장은 없습니다.
- 문제를 해결하는 데 계산 자원이 많이 필요하다고 판단되면 C/C++를 사용할 것을 권장합니다.
- C++26과 Rust 2024 Nightly는 실험용 언어로 채점 환경 및 컴파일 환경이 수시로 변경될 수 있으며, 정상적인 작동을 보장하지 않습니다.
유의 사항
아래의 예시처럼 특정 플랫폼(특히, Windows나 Visual C++)에서만 동작하는 코드를 작성하지 않도록 유의하시기 바랍니다.
| 사용금지 예시 | 비고 |
|---|---|
void main() | 표준에 따라 int main이어야 함 |
getch() | 대신 getchar()를 사용 |
fflush(stdin) | 비표준 함수 사용 |
GetTickCount() | Windows API 는 사용할 수 없음 |
CString | CString은 표준이 아니며 사용할 수 없음. 대신 std::string 을 사용 |
#include <stdafx.h> | stdafx.h는 Visual C++ 전용 precompiled header임 |
Java 유의 사항
클래스 이름은 반드시 Main 이어야 합니다.
표준 입출력 사용하기
모든 코드 제출 문제에서는 주어진 입력 형식에 따라 표준 입력 (standard input)으로 입력을 받고 주어진 출력 형식에 따라 표준 출력(standard output)으로 출력해야 합니다.
아래 예시와 같이 두 개의 정수를 받아 곱하여 출력해야 하는 문제가 있다면, 언어별로 표준 입력과 표준 출력을 처리하는 방법은 아래와 같습니다.
입력 예시
8 4
출력 예시
32
언어별 코드 예시
C20
#include <stdio.h>
int main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("%d\n", a * b);
return 0;
}C++20
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a * b << endl;
return 0;
}Python3
a, b = map(int, input().split())
print(a * b)Pypy3
a, b = map(int, input().split())
print(a * b)Java 21
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a * b);
}
}Rust 2024
use std::io;
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
let nums: Vec<i32> = input.trim().split_whitespace()
.map(|x| x.parse().unwrap())
.collect();
println!("{}", nums[0] * nums[1]);
}Node.js
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const [a, b] = input.split(' ').map(Number);
console.log(a * b);Typescript 5.8.3
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const [a, b] = input.split(' ').map(Number);
console.log(a * b);C# 9
using System;
class Program {
static void Main() {
string[] input = Console.ReadLine().Split(' ');
int a = int.Parse(input[0]);
int b = int.Parse(input[1]);
Console.WriteLine(a * b);
}
}Go
package main
import (
"fmt"
)
func main() {
var a, b int
fmt.Scanf("%d %d", &a, &b)
fmt.Println(a * b)
}LuaJIT
a, b = io.read("*n", "*n")
print(a * b)Lua 5.4
a, b = io.read("*n", "*n")
print(a * b)Kotlin JVM 2.1
fun main() {
val (a, b) = readLine()!!.split(" ").map { it.toInt() }
println(a * b)
}Kotlin/Native 2.1
fun main() {
val (a, b) = readLine()!!.split(" ").map { it.toInt() }
println(a * b)
}프로그램의 종료 코드 (exit code)
작성된 프로그램은 프로그램의 종료 코드가 항상 0 (정상종료)이 되어야합니다. 0으로 종료되지 않는 경우 맞는 답을 출력하는 프로그램을 제출하였더라도 채점이 되지 않을 수 있습니다.
특히 종료 코드를 0으로 하는 코드를 제출하였더라도 작성한 프로그램의 런타임 에러 여부에 따라 0이 아닌 코드로 종료될 수 있습니다.