# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
414909 | 2021-05-31T10:34:41 Z | Pro_ktmr | None (JOI16_memory2) | C++17 | 1 ms | 332 KB |
#include"bits/stdc++.h" using namespace std; typedef long long ll; const ll MOD = (ll)(1e9+7); #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++) #include"Memory2_lib.h" // int Flip(int I, int J) // void Answer(int I, int J, int X) void Solve(int T, int N){ vector<pair<int,int>> v[50]; rep(i, N){ int ret = Flip(2*i, 2*i+1); v[ret].pb({2*i, 2*i+1}); } bool flg = true; while(flg){ flg = false; rep(i, N){ if(v[i].size() == 2){ rep(j, 2){ rep(k, 2){ int a, b; if(j == 0) a = v[i][0].first; else a = v[i][0].second; if(k == 0) b = v[i][1].first; else b = v[i][1].second; int ret = Flip(a, b); if(ret != i){ v[ret].pb({a, b}); Answer(v[i][0].first+v[i][0].second-a, v[i][1].first+v[i][1].second-b, i); v[i].clear(); flg = true; } } if(flg) break; } break; } } } rep(i, N){ if(v[i].size() == 1){ Answer(v[i][0].first, v[i][0].second, i); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 292 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 288 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 288 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 292 KB | Output is correct |
8 | Correct | 1 ms | 292 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 292 KB | Output is correct |