Submission #293468

#TimeUsernameProblemLanguageResultExecution timeMemory
293468MuhammetaliHighway Tolls (IOI18_highway)C++11
Compilation error
0 ms0 KiB
#include "highway.h" #include <bits/stdc++.h> #define REP(i,a) for (int i = 0; i < (a); ++i) #define FOR(i,a,b) for (int i = (a); i <= (b); ++i) #define F0R(i,a) FOR(i,0,a) #define trav(a,x) for (auto& a: x) using namespace std; vector<int> v,ab,coun; vector<pair<int,int>> par[N]; int a,b,jem[N]={INT_MAX}; void dfs(int k,int gos=0) { REP(i,sz(par[k])) { if (jem[par[k][i].first]>gos+ab[v[par[k][i].second]]) { jem[par[k][i].first]=gos+ab[v[par[k][i].second]]; dfs(par[k][i].first,gos+ab[v[par[k][i].second]]); } } } void sum(int toll) { dfs(1); REP(i,coun.size()) { if (coun[i]==1)continue; if (jem[coun[i]]!=toll)count.erase(i,1); } } void recur(int M,int sum=0) { if (sum==M) { sum(ask(v)); return; } FOR(i,0,1) { v.push_back(i); recur(M,sum+1); v.pop_back(); } } void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) { int M = U.size(); ab.push_back(A); ab.push_back(B); bool bo[N]={0}; REP(i,sz(U)) { if (bo[U[i]]==0) { bo[U[i]]=1; coun.push_back(U[i]); } if (bo[V[i]]==0) { bo[V[i]]=1; coun.push_back(V[i]); } par[U[i]].push_back({V[i],i}); par[V[i]].push_back({U[i],i}); } recur(M); answer(count[0],count[1]); }

Compilation message (stderr)

highway.cpp:9:27: error: 'N' was not declared in this scope
    9 | vector<pair<int,int>> par[N];
      |                           ^
highway.cpp:10:13: error: 'N' was not declared in this scope
   10 | int a,b,jem[N]={INT_MAX};
      |             ^
highway.cpp: In function 'void dfs(int, int)':
highway.cpp:13:11: error: 'par' was not declared in this scope
   13 |  REP(i,sz(par[k]))
      |           ^~~
highway.cpp:3:39: note: in definition of macro 'REP'
    3 | #define REP(i,a) for (int i = 0; i < (a); ++i)
      |                                       ^
highway.cpp:13:8: error: 'sz' was not declared in this scope
   13 |  REP(i,sz(par[k]))
      |        ^~
highway.cpp:3:39: note: in definition of macro 'REP'
    3 | #define REP(i,a) for (int i = 0; i < (a); ++i)
      |                                       ^
highway.cpp:15:7: error: 'jem' was not declared in this scope
   15 |   if (jem[par[k][i].first]>gos+ab[v[par[k][i].second]])
      |       ^~~
highway.cpp: In function 'void sum(int)':
highway.cpp:3:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define REP(i,a) for (int i = 0; i < (a); ++i)
      |                                    ^
highway.cpp:25:2: note: in expansion of macro 'REP'
   25 |  REP(i,coun.size())
      |  ^~~
highway.cpp:28:7: error: 'jem' was not declared in this scope
   28 |   if (jem[coun[i]]!=toll)count.erase(i,1);
      |       ^~~
highway.cpp:28:32: error: overloaded function with no contextual type information
   28 |   if (jem[coun[i]]!=toll)count.erase(i,1);
      |                                ^~~~~
highway.cpp: In function 'void recur(int, int)':
highway.cpp:35:13: error: 'sum' cannot be used as a function
   35 |   sum(ask(v));
      |             ^
highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:50:8: error: 'sz' was not declared in this scope
   50 |  REP(i,sz(U))
      |        ^~
highway.cpp:3:39: note: in definition of macro 'REP'
    3 | #define REP(i,a) for (int i = 0; i < (a); ++i)
      |                                       ^
highway.cpp:62:3: error: 'par' was not declared in this scope
   62 |   par[U[i]].push_back({V[i],i});
      |   ^~~
highway.cpp:66:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   66 |  answer(count[0],count[1]);
      |                ^
highway.cpp:66:25: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   66 |  answer(count[0],count[1]);
      |                         ^