# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1043204 | 2024-08-04T04:50:20 Z | model_code | Circle Passing (EGOI24_circlepassing) | C++17 | 9 ms | 956 KB |
#include <bits/stdc++.h> using namespace std; int n ,m ,q; int k; int dist(int x ,int y){ return min(abs(x-y), n+n - abs(x-y)); } int dist(int x ,int k ,int y){ return dist(x ,k) + 1 + dist(k < n? k+n : k-n ,y); } int solve(int x ,int y){ return min({dist(x ,y) ,dist(x ,k ,y)}); } int main() { scanf("%d%d%d",&n,&m,&q); assert(m == 1); scanf("%d",&k); while(q--){ int x ,y; scanf("%d%d",&x,&y); printf("%d\n",solve(x ,y)); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 348 KB | Output is correct |
2 | Correct | 4 ms | 348 KB | Output is correct |
3 | Correct | 3 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 3 ms | 604 KB | Output is correct |
6 | Correct | 5 ms | 708 KB | Output is correct |
7 | Correct | 4 ms | 860 KB | Output is correct |
8 | Correct | 9 ms | 956 KB | Output is correct |
9 | Correct | 7 ms | 860 KB | Output is correct |
10 | Correct | 5 ms | 860 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 856 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 1 ms | 600 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 348 KB | Output is correct |
2 | Correct | 4 ms | 348 KB | Output is correct |
3 | Correct | 3 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 3 ms | 604 KB | Output is correct |
6 | Correct | 5 ms | 708 KB | Output is correct |
7 | Correct | 4 ms | 860 KB | Output is correct |
8 | Correct | 9 ms | 956 KB | Output is correct |
9 | Correct | 7 ms | 860 KB | Output is correct |
10 | Correct | 5 ms | 860 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Incorrect | 0 ms | 348 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |