제출 #140143

#제출 시각아이디문제언어결과실행 시간메모리
140143rajarshi_basu자동 인형 (IOI18_doll)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "doll.h" #define FOR(i,n) for(int i = 0;i<n;i++) #define FORE(i,a,b) for(int i= a;i<=b;i++) #define ll long long int #define vi vector<int> #define vv vector #define pb push_back #define ii pair<int,int> using namespace std; const int MAXN = 4e5; int n,m; vi out[MAXN]; int ctr = 1; int x[MAXN]; int y[MAXN]; //void answer(vi a,vi b,vi c){ for(auto e : a)cout << e << " ";cout << endl; FOR(i,b.size()){ cout << b[i] << " " << c[i] << endl; } } int solve(vi nums){ if(nums.size() == 1)return nums[0]; vi lft;vi rght; FOR(i,nums.size()){ if(i%2 == 0){ lft.pb(nums[i]); }else{ rght.pb(nums[i]); } } int xx = solve(lft); int yy = solve(rght); x[ctr] = xx; y[ctr] = yy; ctr++; return -(ctr-1); } void create_circuit(int m,vi a){ ::m = m; n = a.size(); vi carr; FOR(i,n){ if(i == n-1){ out[a[i]].pb(0); }else{ out[a[i]].pb(a[i+1]); } } FOR(i,m)reverse(out[i].begin(),out[i].end()); out[0].pb(a[0]); vi outof(m+1); FOR(i,m){ if(out[i].size() == 0){ outof[i] = 0; }else{ outof[i] = solve(out[i]); } } vi xx; vi yy; FORE(i,1,ctr-1){ xx.pb(x[i]); yy.pb(y[i]); } answer(outof,xx,yy); } int mai1n(){ vi all; all.pb(1); all.pb(2); all.pb(1); all.pb(3); create_circuit(4,all); return 0; }

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

doll.cpp:24:2: error: expected unqualified-id before 'for'
   24 |  for(auto e : a)cout << e << " ";cout << endl;
      |  ^~~
doll.cpp:24:34: error: 'cout' does not name a type; did you mean 'out'?
   24 |  for(auto e : a)cout << e << " ";cout << endl;
      |                                  ^~~~
      |                                  out
doll.cpp:5:18: error: expected unqualified-id before 'for'
    5 | #define FOR(i,n) for(int i = 0;i<n;i++)
      |                  ^~~
doll.cpp:25:2: note: in expansion of macro 'FOR'
   25 |  FOR(i,b.size()){
      |  ^~~
doll.cpp:25:6: error: 'i' does not name a type
   25 |  FOR(i,b.size()){
      |      ^
doll.cpp:5:32: note: in definition of macro 'FOR'
    5 | #define FOR(i,n) for(int i = 0;i<n;i++)
      |                                ^
doll.cpp:25:6: error: 'i' does not name a type
   25 |  FOR(i,b.size()){
      |      ^
doll.cpp:5:36: note: in definition of macro 'FOR'
    5 | #define FOR(i,n) for(int i = 0;i<n;i++)
      |                                    ^
doll.cpp:28:1: error: expected declaration before '}' token
   28 | }
      | ^
doll.cpp: In function 'int solve(std::vector<int>)':
doll.cpp:5:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define FOR(i,n) for(int i = 0;i<n;i++)
......
   33 |  FOR(i,nums.size()){
      |      ~~~~~~~~~~~~~               
doll.cpp:33:2: note: in expansion of macro 'FOR'
   33 |  FOR(i,nums.size()){
      |  ^~~