Submission #875659

#TimeUsernameProblemLanguageResultExecution timeMemory
875659IsamArt Exhibition (JOI18_art)C++17
0 / 100
4 ms348 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 = 1e9 + 7; int ans = -inf; int n; 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{-inf}, 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); } } ans = max(ans, s - mxa + mna); } cout << ans << '\n'; return 0; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:24:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |     for(register int i = 1; i <= n; ++i){
      |                      ^
art.cpp:27:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   27 |     for(register int mask = 1; mask < (1LL << n); ++mask){
      |                      ^~~~
art.cpp:29:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   29 |         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...