Submission #121956

#TimeUsernameProblemLanguageResultExecution timeMemory
121956DodgeBallManArt Exhibition (JOI18_art)C++14
100 / 100
296 ms21076 KiB
#include <bits/stdc++.h> #define pll pair<long long, long long> #define x first #define y second using namespace std; vector<pll> v; int n; long long ans, pref, mx; int main() { scanf("%d",&n); for( int i = 1 ; i <= n ; i++ ) { long long a, b; scanf("%lld %lld",&a,&b); v.emplace_back( pll( a, b ) ); } sort( v.begin(), v.end() ); for( int i = 0 ; i < n ; i++ ) { long long a, b; tie( a, b ) = v[i]; mx = max( mx, a - pref ); pref += b; ans = max( ans, pref - a + mx ); } printf("%lld",ans); return 0; }

Compilation message (stderr)

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