제출 #816985

#제출 시각아이디문제언어결과실행 시간메모리
816985vjudge1Split the Attractions (IOI19_split)C++17
컴파일 에러
0 ms0 KiB
#include "split.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; #define pb push_back #define mp make_pair typedef long long ll; typedef pair<int,int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vl; vi G[100100], children[100100]; bool vis[100100]; int A, B, C, N, timer = 0, tez[100100], tag[100100], low[100100]; vi ret; bool found = false, special[100100]; void dfs2(int at, int tip, int &cnt){ if(cnt > 0){ cnt--; ret[at] = tip; } else{ ret[at] = 3; } for(auto next:children[at]){ dfs2(next, tip,cnt); } } void dfs3(int at,int tip,int &cnt){ if(cnt > 0){ cnt--; ret[at] = tip; } else{ ret[at] = 3; } for(auto next:G[at]){ if(ret[next] == 0){ dfs3(next,tip,cnt); } } } void dfs(int at){ tag[at] = low[at] = ++timer; tez[at] = 1; for(auto next:G[at]){ if(tag[next] == 0){ dfs(next); children[at].pb(next); tez[at] += tez[next]; low[at] = min(low[at],low[next]); } else{ low[at] = min(low[at],tag[next]); } } if(found){ return ; } if(tez[at] >= A){ int tmp = tez[at]; for(auto next:children[at]){ if(low[next] < tag[at] && tmp - tez[next] >= A){ tmp -= tez[next continue; } dfs2(next,1,need );]; special[next] = true; } } if(tmp >= A && N- tmp >= B){ found = true; int need = A-1; ret[at] = 1; for(auto next:children[at]){ if(special[next] == true){ } need = B; dfs3(0,2,need); } else if(tmp >= B && N - tmp >= A){ found = true; int need = B - 1; ret[at] = 2; for(auto next:children[at]){ if(special[next] == true){ continue; } dfs2(next,2,need); } need= A; dfs3(0,1,need); } } } vi find_split(int n, int a, int b, int c, vi p, vi q) { vi put = {0, 1, 2, 3}; if(b < a){ swap(a, b); swap(put[1], put[2]); } else if(c < a){ swap(a, c); swap(put[1], put[3]); } if(b > c){ swap(b, c); swap(put[2], put[3]); } A = a; B = b; C = c; N = n; ret.resize(n,0); for(int i = 0; i < (int)q.size(); i++){ G[p[i]].pb(q[i]); G[q[i]].pb(p[i]); } dfs(0); for(int i = 0; i < n; i++){ ret[i] = put[ret[i]]; } return ret; }

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

split.cpp: In function 'void dfs(int)':
split.cpp:68:32: error: expected ']' before 'continue'
   68 |                 tmp -= tez[next
      |                                ^
      |                                ]
   69 |                     continue;
      |                     ~~~~~~~~    
split.cpp:68:32: error: expected ';' before 'continue'
   68 |                 tmp -= tez[next
      |                                ^
      |                                ;
   69 |                     continue;
      |                     ~~~~~~~~    
split.cpp:71:29: error: 'need' was not declared in this scope
   71 |                 dfs2(next,1,need );];
      |                             ^~~~
split.cpp:71:36: error: expected primary-expression before ']' token
   71 |                 dfs2(next,1,need );];
      |                                    ^
split.cpp:76:12: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   76 |         if(tmp >= A && N- tmp >= B){
      |            ^~~
      |            tm
split.cpp:87:9: error: expected '}' before 'else'
   87 |         else if(tmp >= B && N - tmp >= A){
      |         ^~~~
split.cpp:76:36: note: to match this '{'
   76 |         if(tmp >= A && N- tmp >= B){
      |                                    ^
split.cpp: At global scope:
split.cpp:101:1: error: expected declaration before '}' token
  101 | }
      | ^