제출 #49657

#제출 시각아이디문제언어결과실행 시간메모리
49657khsoo01Unscrambling a Messy Bug (IOI16_messy)C++11
100 / 100
4 ms640 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; int n; void Add (int S, int E) { if(S >= E) return; int M = (S+E)/2; for(int k=S;k<=M;k++) { string R = ""; for(int i=0;i<n;i++) { if(i < S || i > E || i == k) R += '1'; else R += '0'; } add_element(R); } Add(S, M); Add(M+1, E); } vector<int> Solve (vector<int> C) { vector<int> va, vb, a, b; if(C.size() == 1) { a.push_back(C[0]); return a; } string tmp = ""; for(int i=0;i<n;i++) { tmp += '1'; } for(int i=0;i<C.size();i++) { tmp[C[i]] = '0'; } for(int i=0;i<C.size();i++) { tmp[C[i]] = '1'; if(check_element(tmp)) va.push_back(C[i]); else vb.push_back(C[i]); tmp[C[i]] = '0'; } a = Solve(va); b = Solve(vb); for(int i=0;i<b.size();i++) { a.push_back(b[i]); } return a; } std::vector<int> restore_permutation(int N, int W, int R) { n = N; Add(0, n-1); compile_set(); vector<int> C, A; for(int i=0;i<n;i++) { C.push_back(i); } vector<int> T = Solve(C); for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(T[j] == i) { A.push_back(j); break; } } } return A; }

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

messy.cpp: In function 'std::vector<int> Solve(std::vector<int>)':
messy.cpp:31:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<C.size();i++) {
              ~^~~~~~~~~
messy.cpp:34:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<C.size();i++) {
              ~^~~~~~~~~
messy.cpp:42:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<b.size();i++) {
              ~^~~~~~~~~
#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...