Submission #1043204

# Submission time Handle Problem Language Result Execution time Memory
1043204 2024-08-04T04:50:20 Z model_code Circle Passing (EGOI24_circlepassing) C++17
14 / 100
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

Main.cpp: In function 'int main()':
Main.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d%d%d",&n,&m,&q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%d",&k);
      |     ~~~~~^~~~~~~~~
Main.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         scanf("%d%d",&x,&y);
      |         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -