제출 #576248

#제출 시각아이디문제언어결과실행 시간메모리
576248AugustinasJucasUnscrambling a Messy Bug (IOI16_messy)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int n; string nl; vector<int> ans; vector<int> nera(vector<int> a ) { vector<int> ret; set<int> setas; for(auto &x : a) setas.insert(x); for(int i = 0; i < n; i++) { if(setas.count(i) == 0) ret.push_back(i); } return ret; } string nr(vector<int> x ) { string ret = nl; for(auto &y : x) ret[y] = '1'; return ret; } void darom(vector<int> mas) { if(mas.size() == 1) return ; vector<int> a, b; for(int i = 0; i < mas.size()/2; i++) { a.push_back(mas[i]); b.push_back(mas[i+mas.size()/2]); } string s = nr(nera(mas)); for(auto &x : b) { s[x] = '1'; add_element(s); s[x] = '0'; } darom(a); darom(b); } int sk = 0; void rask(vector<int> mas) { if(mas.size() == 1) { ans[mas[0]] = sk; return ; } string s = nr(nera(mas)); vector<int> a, b; for(auto &x : mas){ s[x] = '1'; if(check_element(s) == 1) { a.push_back(x); }else { b.push_back(x); } s[x] = '0'; } sk = sk * 2 + 1; rask(a); sk--; rask(b); sk /= 2; } vector<int> restore_permutation(int N, int w, int r) { /* add_element("0"); compile_set(); check_element("0"); */ n = N; ans.resize(n); for(int i = 0; i < n; i++) nl.push_back('0'); vector<int> ms; for(int i = 0; i < n; i++) ms.push_back(i); darom(ms); compile_set(); rask(ms); return ans; }

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

messy.cpp: In function 'void darom(std::vector<int>)':
messy.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i = 0; i < mas.size()/2; i++) {
      |                    ~~^~~~~~~~~~~~~~
messy.cpp:30:9: error: 'add_element' was not declared in this scope
   30 |         add_element(s);
      |         ^~~~~~~~~~~
messy.cpp: In function 'void rask(std::vector<int>)':
messy.cpp:46:12: error: 'check_element' was not declared in this scope
   46 |         if(check_element(s) == 1) {
      |            ^~~~~~~~~~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:70:5: error: 'compile_set' was not declared in this scope
   70 |     compile_set();
      |     ^~~~~~~~~~~