Submission #1105697

#TimeUsernameProblemLanguageResultExecution timeMemory
1105697ElayV13Circle Passing (EGOI24_circlepassing)C++17
14 / 100
34 ms980 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define int long long #define ld long double #define FOR(T) for(int i = 1;i <= T;i++) solve(); #define READ(a) for(int i = 0;i < a.size();i++) cin >> a[i]; #define NTL ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); const int INF = 1e18; const int sz = 1e6 + 5; const int mod = 1e9 + 7; int cnt(int x , int y , int n) { int cl = abs(x - y); int y2; if(y >= x) { y2 = x + ((2*n) - y); } else { y2 = y + ((2*n) - x); } return (min(cl,y2)); } void solve(){ int n , m , q; cin >> n >> m >> q; int d; cin >> d; while(q--) { int x , y; cin >> x >> y; cout << min(cnt(x , y , n) , 1 + cnt(d + n , y , n)) << endl; } } signed main(){ NTL; int T = 1; //cin >> T; FOR(T); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...