Submission #875765

#TimeUsernameProblemLanguageResultExecution timeMemory
875765IsamArt Exhibition (JOI18_art)C++17
50 / 100
1069 ms10028 KiB
#include<bits/stdc++.h> #define SPEED ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define int long long #define a first #define b second #define pii pair<int, int> using namespace std; const int sz = 2e5 + 5; const int inf = 1e15 + 7; int n, ans; pii c[sz]; int pref[sz]; int comp(int mna, int mxa, int s){ return s - (mxa - mna); } signed main(){ SPEED; cin >> n; for(register int i = 1; i <= n; ++i){ cin >> c[i].a >> c[i].b; c[i].b *= (-1); } sort(c+1, c+n+1); for(register int i = 1; i <= n; ++i) pref[i] = pref[i-1] - c[i].b; for(register int i = 1; i < n; ++i){ for(register int j = i; j <= n; ++j){ int tmp = comp(c[i].a, c[j].a, pref[j] - pref[i-1]); ans = max(ans, tmp); } } cout << ans << '\n'; return 0; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:27:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   27 |     for(register int i = 1; i <= n; ++i){
      |                      ^
art.cpp:32:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   32 |     for(register int i = 1; i <= n; ++i) pref[i] = pref[i-1] - c[i].b;
      |                      ^
art.cpp:33:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   33 |     for(register int i = 1; i < n; ++i){
      |                      ^
art.cpp:34:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   34 |         for(register int j = i; j <= n; ++j){
      |                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...