Submission #112966

#TimeUsernameProblemLanguageResultExecution timeMemory
112966imaxblue통행료 (IOI18_highway)C++17
Compilation error
0 ms0 KiB
int n, m, a, b, sz[90005], ds[90005]; ll dis; vector<pii> v[90005]; bool u[90005], typ; vector<int> on; vector<int> out; bool split = 0; void dfs0(int N, int P){ sz[N] = 1; for(auto i:v[N]){ if (i.x == P || u[i.y]) continue; dfs0(i.x, N); sz[N]+=sz[i.x]; } //cout <<"*" << N << ' ' << sz[N] << endl; } void dfs2(int N, int P){ for(auto i:v[N]){ if (u[i.y] || i.x == P) continue; on[i.y] = typ; dfs2(i.x, N); } } void dfs3(int N, int P, int D){ ds[N] = D; for(auto i:v[N]){ if (u[i.y] || i.x == P) continue; dfs3(i.x, N, D+1); } } void dfs(int N){ //cout << "?"; dfs0(N, -1); bool done = 0; int R = N; int S = sz[N], P = -1, last; if (S == 1){ out.pb(N); return; } while(!done){ done = 1; for(auto i:v[N]){ if (u[i.y] || i.x == P) continue; if (sz[i.x]*2 >= S){ P = N; N = i.x; last = i.y; done = 0; break; } } } bool spec=0; if (P == -1){ spec= 1; int hs = 0; for(auto i:v[N]){ if (u[i.y]) continue; if (sz[i.x] > hs){ hs = sz[i.x]; P = i.x; last = i.y; } } } //cout << "?" << last << endl; on[last] = 1; typ = 0; dfs2(P, N); typ = 1; dfs2(N, P); bool res1 = (ask(on) - dis > 0); typ = 1; dfs2(P, N); typ = 0; dfs2(N, P); bool res2 = (ask(on) - dis > 0); //cout << "*" << N << ' ' << P << ' ' << last << ' ' << res1 << ' ' << res2 << ' ' << split<< endl; typ = 0; dfs2(P, N); typ = 0; dfs2(N, P); on[last] = 0; if (res1 == 0 && res2 == 0 && split == 0){ out.pb(N); out.pb(P); return; } else if (res1 == 0 && res2 == 0){ out.pb(R); return; } u[last] = 1; if (!split){ if (res1 && res2){ split = 1; dfs3(N, -1, 0); } if (res1){ dfs(N); } if (res2){ dfs(P); } } else if (split){ if (ds[N] > ds[P]){ if (res1 ){ dfs(N); } else { dfs(P); } } else { if (res2){ dfs(P); } else { dfs(N); } } } } void find_pair(int N,vector<int> U, vector<int> V, int A, int B){ n = N; m = U.size(); a = A; b = B; on = vector<int>(m, 0); fox(l, m){ v[U[l]].pb(mp(V[l], l)); v[V[l]].pb(mp(U[l], l)); } dis = ask(vector<int>(m, 0)); dfs(0); //cout << out.size() << endl; answer(out[0], out[1]); }

Compilation message (stderr)

highway.cpp:3:1: error: 'll' does not name a type
 ll dis;
 ^~
highway.cpp:4:1: error: 'vector' does not name a type
 vector<pii> v[90005];
 ^~~~~~
highway.cpp:6:1: error: 'vector' does not name a type
 vector<int> on;
 ^~~~~~
highway.cpp:7:1: error: 'vector' does not name a type
 vector<int> out;
 ^~~~~~
highway.cpp: In function 'void dfs0(int, int)':
highway.cpp:11:14: error: 'v' was not declared in this scope
   for(auto i:v[N]){
              ^
highway.cpp: In function 'void dfs2(int, int)':
highway.cpp:19:14: error: 'v' was not declared in this scope
   for(auto i:v[N]){
              ^
highway.cpp:21:5: error: 'on' was not declared in this scope
     on[i.y] = typ;
     ^~
highway.cpp:21:5: note: suggested alternative: 'n'
     on[i.y] = typ;
     ^~
     n
highway.cpp: In function 'void dfs3(int, int, int)':
highway.cpp:27:14: error: 'v' was not declared in this scope
   for(auto i:v[N]){
              ^
highway.cpp: In function 'void dfs(int)':
highway.cpp:39:5: error: 'out' was not declared in this scope
     out.pb(N);
     ^~~
highway.cpp:39:5: note: suggested alternative: 'auto'
     out.pb(N);
     ^~~
     auto
highway.cpp:44:16: error: 'v' was not declared in this scope
     for(auto i:v[N]){
                ^
highway.cpp:59:16: error: 'v' was not declared in this scope
     for(auto i:v[N]){
                ^
highway.cpp:69:3: error: 'on' was not declared in this scope
   on[last] = 1;
   ^~
highway.cpp:69:3: note: suggested alternative: 'n'
   on[last] = 1;
   ^~
   n
highway.cpp:74:16: error: 'ask' was not declared in this scope
   bool res1 = (ask(on) - dis > 0);
                ^~~
highway.cpp:74:16: note: suggested alternative: 'last'
   bool res1 = (ask(on) - dis > 0);
                ^~~
                last
highway.cpp:74:26: error: 'dis' was not declared in this scope
   bool res1 = (ask(on) - dis > 0);
                          ^~~
highway.cpp:74:26: note: suggested alternative: 'dfs'
   bool res1 = (ask(on) - dis > 0);
                          ^~~
                          dfs
highway.cpp:88:5: error: 'out' was not declared in this scope
     out.pb(N); out.pb(P);
     ^~~
highway.cpp:88:5: note: suggested alternative: 'auto'
     out.pb(N); out.pb(P);
     ^~~
     auto
highway.cpp:91:5: error: 'out' was not declared in this scope
     out.pb(R);
     ^~~
highway.cpp:91:5: note: suggested alternative: 'auto'
     out.pb(R);
     ^~~
     auto
highway.cpp: At global scope:
highway.cpp:123:22: error: 'vector' has not been declared
 void find_pair(int N,vector<int> U, vector<int> V, int A, int B){
                      ^~~~~~
highway.cpp:123:28: error: expected ',' or '...' before '<' token
 void find_pair(int N,vector<int> U, vector<int> V, int A, int B){
                            ^
highway.cpp: In function 'void find_pair(int, int)':
highway.cpp:124:14: error: 'U' was not declared in this scope
   n = N; m = U.size(); a = A; b = B;
              ^
highway.cpp:124:28: error: 'A' was not declared in this scope
   n = N; m = U.size(); a = A; b = B;
                            ^
highway.cpp:124:35: error: 'B' was not declared in this scope
   n = N; m = U.size(); a = A; b = B;
                                   ^
highway.cpp:125:3: error: 'on' was not declared in this scope
   on = vector<int>(m, 0);
   ^~
highway.cpp:125:3: note: suggested alternative: 'n'
   on = vector<int>(m, 0);
   ^~
   n
highway.cpp:125:8: error: 'vector' was not declared in this scope
   on = vector<int>(m, 0);
        ^~~~~~
highway.cpp:125:15: error: expected primary-expression before 'int'
   on = vector<int>(m, 0);
               ^~~
highway.cpp:126:7: error: 'l' was not declared in this scope
   fox(l, m){
       ^
highway.cpp:126:3: error: 'fox' was not declared in this scope
   fox(l, m){
   ^~~
highway.cpp:130:3: error: 'dis' was not declared in this scope
   dis = ask(vector<int>(m, 0));
   ^~~
highway.cpp:130:3: note: suggested alternative: 'dfs'
   dis = ask(vector<int>(m, 0));
   ^~~
   dfs
highway.cpp:130:20: error: expected primary-expression before 'int'
   dis = ask(vector<int>(m, 0));
                    ^~~
highway.cpp:130:9: error: 'ask' was not declared in this scope
   dis = ask(vector<int>(m, 0));
         ^~~
highway.cpp:133:10: error: 'out' was not declared in this scope
   answer(out[0], out[1]);
          ^~~
highway.cpp:133:10: note: suggested alternative: 'auto'
   answer(out[0], out[1]);
          ^~~
          auto
highway.cpp:133:3: error: 'answer' was not declared in this scope
   answer(out[0], out[1]);
   ^~~~~~