Submission #1233328

#TimeUsernameProblemLanguageResultExecution timeMemory
1233328kaltspielerhyUnscrambling a Messy Bug (IOI16_messy)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; #include "messy.h" vector<int> restore_permutation(int n, int w, int r) { string e1; string e2; for (int i = 0; i < n; i++) { if (i % 2 == 0) { e1.push_back('0'); } else { e1.push_back('1'); } if (i%4 == 0 || 1%4 == 3) { e2.push_back('1'); } else { e2.push_back('0'); } } add_element(e1); add_element(e2); compile_set(); vector<int> permutation(n); for (int i = 0; i < n; i++) permutation[i] = i; bool finished = false; for (int d = 0; d < n; d++) { for (int f = d+1; f < n; f++) { swap(e1[d], e1[f]); swap(e2[d], e2[f]); if (check_element(e1) && check_element(e2)) { // cerr << d << ' ' << f << '\n'; if (finished) { for (int i = 0; i < n; i++) permutation[i] = i; swap(e1[d], e1[f]); swap(e2[d], e2[f]); break; } swap(permutation[d], permutation[f]); finished = true; swap(e1[d], e1[f]); swap(e2[d], e2[f]); break; } swap(e1[d], e1[f]); swap(e2[d], e2[f]); } } return permutation; }

Compilation message (stderr)

messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...