(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1123642

#TimeUsernameProblemLanguageResultExecution timeMemory
1123642codexistentTraffic (IOI10_traffic)C++20
Compilation error
0 ms0 KiB
#include "traffic.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define MAXN 1000005 #define FOR(i, a, b) for(ll i = a; i <= b; i++) ll r[MAXN], s = 0, cgd[MAXN]; vector<ll> adj[MAXN]; pair<ll, ll> ans; void dfs(ll i, ll p = -1){ for(ll i2 : adj[i]) if(i2 != p) { dfs(i2, i); r[i] = max(r[i], cgd[i2]); cgd[i] += cgd[i2]; } r[i] = max(r[i], s - cgd[i]); } int LocateCentre(int N, int pp[], int S[], int D[]) { FOR(i, 0, n - 2) adj[S[i]].push_back(D[i]), adj[D[i]].push_back(S[i]); FOR(i, 0, n - 1) cgu[i] = pp[i], cgd[i] = {0, 0}, s += pp[i]; dfs(0); ans = {LLONG_MAX, LLONG_MAX}; FOR(i, 0, n - 1) ans = min(ans, {r[i], i}); return ans.second; }

Compilation message (stderr)

traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:22:15: error: 'n' was not declared in this scope
   22 |     FOR(i, 0, n - 2) adj[S[i]].push_back(D[i]), adj[D[i]].push_back(S[i]);
      |               ^
traffic.cpp:6:41: note: in definition of macro 'FOR'
    6 | #define FOR(i, a, b) for(ll i = a; i <= b; i++)
      |                                         ^
traffic.cpp:23:15: error: 'n' was not declared in this scope
   23 |     FOR(i, 0, n - 1) cgu[i] = pp[i], cgd[i] = {0, 0}, s += pp[i];
      |               ^
traffic.cpp:6:41: note: in definition of macro 'FOR'
    6 | #define FOR(i, a, b) for(ll i = a; i <= b; i++)
      |                                         ^
traffic.cpp:23:22: error: 'cgu' was not declared in this scope; did you mean 'cgd'?
   23 |     FOR(i, 0, n - 1) cgu[i] = pp[i], cgd[i] = {0, 0}, s += pp[i];
      |                      ^~~
      |                      cgd
traffic.cpp:23:52: error: cannot convert '<brace-enclosed initializer list>' to 'long long int' in assignment
   23 |     FOR(i, 0, n - 1) cgu[i] = pp[i], cgd[i] = {0, 0}, s += pp[i];
      |                                                    ^
traffic.cpp:27:15: error: 'n' was not declared in this scope
   27 |     FOR(i, 0, n - 1) ans = min(ans, {r[i], i});
      |               ^
traffic.cpp:6:41: note: in definition of macro 'FOR'
    6 | #define FOR(i, a, b) for(ll i = a; i <= b; i++)
      |                                         ^