Submission #790758

#TimeUsernameProblemLanguageResultExecution timeMemory
790758khshgUnscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
1 ms340 KiB
#include"messy.h" #include<bits/stdc++.h> using namespace std; vector<int> restore_permutation(int N, int W, int R) { string S(N, '0'); for(int i = 0; i + 1 < N; ++i) { S[i] = '1'; add_element(S); } compile_set(); vector<int> ans(N, -1); for(int i = 0; i < N; ++i) { S = string(N, '0'); for(int j = 0; j < i; ++j) S[ans[j]] = '1'; for(int j = 0; j < N; ++j) { if(S[j] == '1') continue; S[j] = '1'; if(!check_element(S)) { S[j] = '0'; continue; } ans[i] = j; break; } } for(int i = 0 ; i < N; ++i) { if(ans[i] == -1) { ans[i] = N * (N - 1) / 2; for(int j = 0; j < N; ++j) { if(i != j) ans[i] -= ans[j]; } } } vector<int> p(N); for(int i= 0; i < N; ++i) { p[ans[i]] = i; } return p; }
#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...