제출 #204488

#제출 시각아이디문제언어결과실행 시간메모리
204488T0p_Art Exhibition (JOI18_art)C++14
10 / 100
15 ms376 KiB
#include<bits/stdc++.h> using namespace std; long long a[20], b[20]; int main() { int n; long long ans = -1e15; 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=1 ; i<(1<<n) ; i++) { int temp = i; long long s = 0, am = 1e15, aM = -1e15; for(int j=1 ; j<=n ; j++) { if(temp%2) { s += b[j]; am = min(am, a[j]); aM = max(aM, a[j]); } temp /= 2; } ans = max(ans, s - (aM - am)); } printf("%lld\n",ans); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

art.cpp: In function 'int main()':
art.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf(" %d",&n);
  ~~~~~^~~~~~~~~~
art.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   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...