제출 #576247

#제출 시각아이디문제언어결과실행 시간메모리
576247AugustinasJucasUnscrambling a Messy Bug (IOI16_messy)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> 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:3:1: error: 'string' does not name a type; did you mean 'stdin'?
    3 | string nl;
      | ^~~~~~
      | stdin
messy.cpp:4:1: error: 'vector' does not name a type
    4 | vector<int> ans;
      | ^~~~~~
messy.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int> nera(vector<int> a ) {
      | ^~~~~~
messy.cpp:14:1: error: 'string' does not name a type; did you mean 'stdin'?
   14 | string nr(vector<int> x ) {
      | ^~~~~~
      | stdin
messy.cpp:19:6: error: variable or field 'darom' declared void
   19 | void darom(vector<int> mas) {
      |      ^~~~~
messy.cpp:19:12: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   19 | void darom(vector<int> mas) {
      |            ^~~~~~
      |            std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from messy.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
messy.cpp:19:19: error: expected primary-expression before 'int'
   19 | void darom(vector<int> mas) {
      |                   ^~~
messy.cpp:36:6: error: variable or field 'rask' declared void
   36 | void rask(vector<int> mas) {
      |      ^~~~
messy.cpp:36:11: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   36 | void rask(vector<int> mas) {
      |           ^~~~~~
      |           std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from messy.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
messy.cpp:36:18: error: expected primary-expression before 'int'
   36 | void rask(vector<int> mas) {
      |                  ^~~
messy.cpp:58:1: error: 'vector' does not name a type
   58 | vector<int> restore_permutation(int N, int w, int r) {
      | ^~~~~~