Submission #195657

#TimeUsernameProblemLanguageResultExecution timeMemory
195657T0p_Art Exhibition (JOI18_art)C++14
0 / 100
3 ms508 KiB
#include<bits/stdc++.h> using namespace std; long long a[20], b[20]; int main(){ int n; long long ans = 0; scanf(" %d",&n); if(n > 16) return 0; for(int i=1 ; i<=n ; i++) scanf(" %lld %lld",&a[i],&b[i]); for(int i=0 ; i<(1<<16) ; i++){ int temp = i; long long S = 0, AM = -1e18, Am = 1e18; for(int j=1 ; j<=16 ; j++){ if(temp%2){ S += b[i]; AM = max(AM, b[i]); Am = min(Am, b[i]); } temp/=2; } ans = max(ans, S - AM + Am); } printf("%lld\n",ans); return 0; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf(" %d",&n);
  ~~~~~^~~~~~~~~~
art.cpp:11:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1 ; i<=n ; i++) scanf(" %lld %lld",&a[i],&b[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...