# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1015094 | 2024-07-06T05:22:18 Z | salmon | Mouse (info1cup19_mouse) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; int N; vector<int> v; void cycle(int j,int je){ int num = v[j]; for(int i = j; i < je; i++){ v[i] = v[i + 1]; } v[je] = num; } void split(int s, vector<int> v){ if(v.size() == 0) return; vector<int> l; vector<int> r; int m = (v.size() - 1) / 2; for(int i = 0; i <= m; i++){ l.push_back(v[i]); } } void solve(int N){ ::N = N; for(int i = 1; i <= N; i++){ v.push_back(i); } set<int> used; for(int i = 0; i < N; i++){ for(int j = 1; j <= N; j++){ if(used.find(j) == used.end()){ v[i] = j; int cont = i + 1; for(int i = 1; i <= N; i++){ if(i != j && used.find(i) == used.end()){ v[cont] = i; cont++; } } int soom = 0; int it = i; for(int i = 0; i < N - it - 1; i++){ cycle(it + 1); int b = query(v); if(b == N) return; soom += b; } soom %= (N - it - 1); if(soom == 0){ used.insert(j); break; } } } } while(true){ query(v); } }