Submission #66723

#TimeUsernameProblemLanguageResultExecution timeMemory
66723yusufakeArt Exhibition (JOI18_art)C++98
100 / 100
346 ms227284 KiB
#include<bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define st first #define nd second typedef long long ll; typedef pair < ll , ll > pp; const int mod = 1e9 + 7; const int N = 5e5 + 5; ll n,i,p,dp,mx,ans; pp A[N]; int main(){ scanf("%lld",&n); for(i=1;i<=n;i++) scanf("%lld%lld",&A[i].st,&A[i].nd); sort(A+1 , A+n+1); ans = mx = -(int)(2e18); for(i=1;i<=n;i++){ mx = max(mx , A[i].st - p); p += A[i].nd; dp = p - A[i].st + mx; ans = max(ans , dp); } printf("%lld",ans); return 0; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
     ~~~~~^~~~~~~~~~~
art.cpp:19:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1;i<=n;i++) scanf("%lld%lld",&A[i].st,&A[i].nd);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...