제출 #1037306

#제출 시각아이디문제언어결과실행 시간메모리
1037306RaresFelixUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
1 ms856 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; using vi = vector<int>; vi restore_permutation(int n, int w, int r) { vector<vi> S; vi V0; for(int i = 0; i < n; ++i) V0.push_back(i); S = {V0}; while(S.size() != n) { vector<vi> Snou; for(auto &V : S) { int len = V.size(); vi V1, V2; for(int i = 0; i < len / 2; ++i) V1.push_back(V[i]); for(int i = 0; i < len / 2; ++i) V2.push_back(V[i + len / 2]); Snou.push_back(V1); Snou.push_back(V2); string s; for(int i = 0; i < n; ++i) s += '0'; for(auto it : V) s[it] = '1'; for(auto it : V1) { s[it] = '0'; add_element(s); s[it] = '1'; } } S = Snou; } compile_set(); S = {V0}; while(S.size() != n) { vector<vi> Snou; for(auto &V : S) { int len = V.size(); string s; for(int i = 0; i < n; ++i) s += '0'; for(auto it : V) s[it] = '1'; vi V1, V2; for(auto it : V) { s[it] = '0'; auto re = check_element(s); if(re) V1.push_back(it); else V2.push_back(it); s[it] = '1'; } Snou.push_back(V1); Snou.push_back(V2); } S = Snou; } vi Re(n, 0); for(int i = 0; i < n; ++i) Re[S[i][0]] = i; return Re; }

컴파일 시 표준 에러 (stderr) 메시지

messy.cpp: In function 'vi restore_permutation(int, int, int)':
messy.cpp:16:20: warning: comparison of integer expressions of different signedness: 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while(S.size() != n) {
      |           ~~~~~~~~~^~~~
messy.cpp:40:20: warning: comparison of integer expressions of different signedness: 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |     while(S.size() != n) {
      |           ~~~~~~~~~^~~~
messy.cpp:43:17: warning: unused variable 'len' [-Wunused-variable]
   43 |             int len = V.size();
      |                 ^~~
#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...