제출 #21890

#제출 시각아이디문제언어결과실행 시간메모리
21890sampritiUnscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
3 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) { P[j] = i; break; } if(check_element(curr)) { P[j] = i; break; } curr[j] = '0'; } } return P; }

컴파일 시 표준 에러 (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) {
          ~~~~^~~~~~~~~~~~~~~~~~~~~
#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...