Submission #1022540

#TimeUsernameProblemLanguageResultExecution timeMemory
1022540TroySerUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms436 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; vector<int> restore_permutation(int n, int w, int r) { string toAdd[n-1]; for (int i = 1; i <= n-1; i++) { string s = ""; for (int j = 0; j < i; j++) { s += "1"; } for (int j = i; j < n; j++) { s += "0"; } toAdd[i - 1] = s; } for (int i = 0; i < n-1; i++) { add_element(toAdd[i]); } compile_set(); vector<int> perm(n, -1); string currString, prevString = ""; for (int i = 0; i < n; i++) prevString.push_back('0'); for (int i = 0; i < n-1; i++) { currString = prevString; bool getOut = false; for (int j = 0; j < n; j++) { if (currString[j] == '0') { currString[j] = '1'; if (check_element(currString)) { perm[j] = i; break; } currString[j] = '0'; } } prevString = currString; } for (int i = 0; i < n; i++) { if (perm[i] == -1) { perm[i] = n-1; break; } } return perm; }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:33:14: warning: unused variable 'getOut' [-Wunused-variable]
   33 |         bool getOut = false;
      |              ^~~~~~
#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...