제출 #293505

#제출 시각아이디문제언어결과실행 시간메모리
293505MuhammetaliHighway Tolls (IOI18_highway)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define mp make_pair #define f first #define s second #define sz(x) (int)(x).size() #define rsz resize #define ins insert #define ft front() #define bk back() #define pf push_front #define pb push_back #define eb emplace_back #define lb lower_bound #define ub upper_bound #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; typedef long long ll; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pl; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<ll> vl; typedef vector<pi> vpi; typedef vector<pl> vpl; template<class T>bool tmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool tmax(T& a,T b){if(a<b){a=b;return 1;}return 0;} ll N,M,a,b,jem[1000]={INT_MAX}; vpl par[1000]; vl U,V,ab,v,coun; bool barmy[1000]; void dfs(ll k,ll gos=0) { for(ll i=0;i<par[k].size();i++) { 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 sums(ll toll) { dfs(1); for(ll i=0;i<coun.size();i++) { if (barmy[i])continue; if (jem[coun[i]]!=toll)barmy[i]=1; } } void recur(ll M,ll sum=0) { if (sum==M) { sums(ask(v)); return; } for(ll i=0;i<2;i++) { v.push_back(i); recur(M,sum+1); v.pop_back(); } } void find_pair(int N, int[] U, int[] V, int A, int B) { bool bo[1000]={0}; for(ll i=0;i<U.size();i++) { 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}); } REP(i,N)coun.pb(i); recur(M); answer(0,coun[0]); }

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

highway.cpp: In function 'void dfs(ll, ll)':
highway.cpp:37:14: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for(ll i=0;i<par[k].size();i++)
      |             ~^~~~~~~~~~~~~~
highway.cpp: In function 'void sums(ll)':
highway.cpp:49:14: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |  for(ll i=0;i<coun.size();i++)
      |             ~^~~~~~~~~~~~
highway.cpp: In function 'void recur(ll, ll)':
highway.cpp:59:8: error: 'ask' was not declared in this scope
   59 |   sums(ask(v));
      |        ^~~
highway.cpp: At global scope:
highway.cpp:69:29: error: expected ',' or '...' before 'U'
   69 | void find_pair(int N, int[] U, int[] V, int A, int B)
      |                             ^
highway.cpp: In function 'void find_pair(int, int*)':
highway.cpp:72:14: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |  for(ll i=0;i<U.size();i++)
      |             ~^~~~~~~~~
highway.cpp:89:2: error: 'answer' was not declared in this scope
   89 |  answer(0,coun[0]);
      |  ^~~~~~