# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1094300 | 2024-09-29T09:58:30 Z | alexdd | Secret Permutation (RMI19_permutation) | C++17 | 5000 ms | 344 KB |
#include "permutation.h" #include <bits/stdc++.h> using namespace std; map<vector<int>,int> mp; int intreaba(vector<int> aux) { if(mp[aux]==0) { mp[aux] = query(aux); } return mp[aux]; } void solve(int N) { mp.clear(); vector<int> v(N); for(int i=0;i<N;i++) v[i]=i+1; while(intreaba(v) > N-1) { for(int i=0;i+1<N;i++) { int init = intreaba(v); swap(v[i],v[i+1]); if(intreaba(v) > init) swap(v[i],v[i+1]); } } vector<int> rez(N); for(int i=0;i<N;i++) rez[v[i]-1]=i+1; answer(rez); } /* 7 2 1 3 7 4 6 5 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5071 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5071 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5071 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |