제출 #796853

#제출 시각아이디문제언어결과실행 시간메모리
796853LiudasTraffic (IOI10_traffic)C++17
50 / 100
226 ms32844 KiB
#include <bits/stdc++.h> #include "traffic.h" using namespace std; int LocateCentre(int N, int P[], int S[], int D[]){ vector<int> suf(N), pref(N), sum(N); for(int i = 1; i < N; i ++){ pref[i] = P[i-1] + pref[i-1]; } for(int i = N-2; i >= 0; i --){ suf[i] = suf[i + 1] + P[i+1]; } int ans = 2e9, x = -1; for(int i = 0; i < N; i ++){ if(max(suf[i], pref[i]) < ans){ ans = max(suf[i], pref[i]); x = i; } } return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...