Submission #875672

#TimeUsernameProblemLanguageResultExecution timeMemory
875672IsamArt Exhibition (JOI18_art)C++17
10 / 100
1047 ms460 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]; signed main(){ SPEED; cin >> n; for(register int i = 1; i <= n; ++i){ cin >> c[i].a >> c[i].b; } for(register int mask = 1; mask < (1LL << n); ++mask){ int s(0), mxa(0), mna{inf}; for(register int i = 1; i <= n; ++i){ if(mask & (1LL << (i-1))){ s += c[i].b; mxa = max(mxa, c[i].a), mna = min(mna, c[i].a); } } int dif = mxa - mna; if(dif > s) continue; ans = max(ans, s - dif); } cout << ans << '\n'; return 0; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:21:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |     for(register int i = 1; i <= n; ++i){
      |                      ^
art.cpp:24:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |     for(register int mask = 1; mask < (1LL << n); ++mask){
      |                      ^~~~
art.cpp:27:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   27 |         for(register int i = 1; i <= n; ++i){
      |                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...