Submission #204067

#TimeUsernameProblemLanguageResultExecution timeMemory
204067KastandaArt Exhibition (JOI18_art)C++11
100 / 100
286 ms20996 KiB
// In The Name Of The Queen #include<bits/stdc++.h> #define x first #define y second using namespace std; typedef long long ll; const int N = 500005; int n; pair < ll , ll > A[N]; int main() { scanf("%d", &n); for (int i = 1; i <= n; i ++) scanf("%lld%lld", &A[i].x, &A[i].y); sort(A + 1, A + n + 1); ll MX = 0, Mxp = 0; for (int i = 1; i <= n; i ++) { MX = max(MX, A[i].y); MX = max(MX, Mxp + A[i].y - A[i].x); Mxp = max(Mxp + A[i].y, A[i].x + A[i].y); } return !printf("%lld\n", MX); }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
art.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld", &A[i].x, &A[i].y);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...