Submission #5009

#TimeUsernameProblemLanguageResultExecution timeMemory
5009aintaGlobal Warming (NOI13_gw)C++98
40 / 40
284 ms8940 KiB
#include<stdio.h> #include<algorithm> using namespace std; int n, i, a, b, w[2010000], c, S, R; int main() { scanf("%d", &n); b = 0; for (i = 1; i <= n; i++){ scanf("%d", &a); if (a > b)w[c++] = b * 2, w[c++] = a * 2 - 1; b = a; } sort(w, w + c); for (i = 0; i < c; i++){ S += (w[i] & 1) ? -1 : 1; if (R < S)R = S; } printf("%d\n", R); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...