Submission #21887

#TimeUsernameProblemLanguageResultExecution timeMemory
21887sampritiUnscrambling a Messy Bug (IOI16_messy)C++14
49 / 100
10 ms384 KiB
#include "messy.h" #include <vector> #include <string> #include <algorithm> using namespace std; std::vector<int> restore_permutation(int N, int w, int r) { srand(time(0)); vector<string> els; for(int i = 0; i < N; i++) { string str = ""; for(int j = 0; j < N; j++) { if(j <= i) str += '1'; else str += '0'; } add_element(str); els.push_back(str); } compile_set(); vector<int> P(N, -1); for(int i = 0; i < N; i++) { string curr = ""; for(int j = 0; j < N; j++) { if(P[j] != -1) curr += '1'; else curr += '0'; } vector<int> indices; for(int j = 0; j < N; j++) { if(curr[j] == '0') indices.push_back(j); } random_shuffle(indices.begin(), indices.end()); for(int ind = 0; ind < indices.size(); ind++) { int j = indices[ind]; curr[j] = '1'; if(ind == indices.size() - 1 || check_element(curr)) { P[j] = i; break; } curr[j] = '0'; } } return P; }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:35:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int ind = 0; ind < indices.size(); ind++) {
                      ~~~~^~~~~~~~~~~~~~~~
messy.cpp:38:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if(ind == indices.size() - 1 || check_element(curr)) {
          ~~~~^~~~~~~~~~~~~~~~~~~~~
#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...