제출 #673773

#제출 시각아이디문제언어결과실행 시간메모리
673773CookieTraffic (IOI10_traffic)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #include "traffic.h" //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") #define ll long long #define vt vector #define pb push_back #define fi first #define se second #define forr(i, a, b) for(int i = a; i < b; i++) #define dorr(i, a, b) for(int i = a; i >= b; i--) typedef unsigned long long ull; #include<fstream> ifstream fin("ss.inp"); ofstream fout("ss.out"); #define pii pair<int, int> #define pll pair<ll, ll> const ll mod = 1e9 + 7, mod2 = 1e9 + 9; const int mxn = 5e4, mxq = 1e5, sq = 800, mxm = 1e5; int n; vt<int>adj[mxn + 1]; ll ans = 1e16, id = -1; void dfs(int s, int pre){ sm[s] = a[s]; ll mx = 0; for(auto i: adj[s]){ if(i != pre){ dfs(i, s); sm[s] += sm[i]; mx = max(mx, sm[i]); } } mx = max(mx, all - sm[s]); if(mx < ans){ ans = mx; id = s; } } int LocateCentre(int n, int a[], int s[], int d[]) { for(int i = 0; i < n; i++){ all += 1LL * a[i]; } forr(i, 0, n - 1){ adj[s[i]].pb(d[i]); adj[d[i]].pb(s[i]); } dfs(0, -1); return(id); }

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

traffic.cpp: In function 'void dfs(int, int)':
traffic.cpp:31:5: error: 'sm' was not declared in this scope; did you mean 's'?
   31 |     sm[s] = a[s];
      |     ^~
      |     s
traffic.cpp:31:13: error: 'a' was not declared in this scope
   31 |     sm[s] = a[s];
      |             ^
traffic.cpp:39:18: error: 'all' was not declared in this scope; did you mean 'ull'?
   39 |     mx = max(mx, all - sm[s]);
      |                  ^~~
      |                  ull
traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:48:9: error: 'all' was not declared in this scope; did you mean 'ull'?
   48 |         all += 1LL * a[i];
      |         ^~~
      |         ull