제출 #286179

#제출 시각아이디문제언어결과실행 시간메모리
286179ne4eHbKa자동 인형 (IOI18_doll)C++17
컴파일 에러
0 ms0 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; namespace solution { typedef vector<int> vi; map<int, list<int> > f; vi c, x, y; int s; int swicch(list<int> &t) { int i = s++; x.push_back(0); y.push_back(0); list<int> a, b; int cnt = 0; for(int &j : t) (cnt++ & 1 ? b : a).push_back(j); x[i] = a.size() - 1 ? swicch(a) : a.front(); y[i] = b.size() - 1 ? swicch(b) : b.front(); return -(i + 1); } void trigger(int i) { if(f.find(i) == f.end()) { c[i] = 0; return; } list<int> &t = f[i]; if(t.size() == 1) { c[i] = t.front(); return; } c[i] = swicch(t); } } void create_circuit (int m, ints a) { using namespace solution; int n = a.size(); f.clear(); for(int i = 1; i < n; ++i) f[a[i - 1]].push_back(a[i]); f[a.back()].push_back(0); c.resize(m + 1); x.clear(); y.clear(); s = 0; c[0] = a.front(); for(int i = 1; i <= m; ++i) trigger(i); answer(c, x, y); }

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

doll.cpp:41:29: error: 'ints' has not been declared
   41 | void create_circuit (int m, ints a) {
      |                             ^~~~
doll.cpp: In function 'void create_circuit(int, int)':
doll.cpp:43:15: error: request for member 'size' in 'a', which is of non-class type 'int'
   43 |     int n = a.size();
      |               ^~~~
doll.cpp:46:12: error: invalid types 'int[int]' for array subscript
   46 |         f[a[i - 1]].push_back(a[i]);
      |            ^
doll.cpp:46:32: error: invalid types 'int[int]' for array subscript
   46 |         f[a[i - 1]].push_back(a[i]);
      |                                ^
doll.cpp:47:9: error: request for member 'back' in 'a', which is of non-class type 'int'
   47 |     f[a.back()].push_back(0);
      |         ^~~~
doll.cpp:52:14: error: request for member 'front' in 'a', which is of non-class type 'int'
   52 |     c[0] = a.front();
      |              ^~~~~