제출 #60392

#제출 시각아이디문제언어결과실행 시간메모리
60392gusfringArt Exhibition (JOI18_art)C++14
0 / 100
2 ms248 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e3 + 5; typedef long long ll; #define sz first #define val second pair<ll, ll> C[MAXN]; ll suf[MAXN], pre[MAXN], res; int N; int main(){ scanf("%d", &N); for(int i=1; i<=N; ++i) scanf("%lld %lld", &C[i].sz, &C[i].val); sort(C + 1, C + N + 1); for(int i=1; i<=N; ++i) pre[i] = pre[i - 1] + C[i].val; for(int i=N; i>=1; --i) suf[i] = max(suf[i + 1], pre[i] - C[i].sz); for(int i=1; i<=N; ++i) res = max(res, suf[i + 1] - pre[i - 1] + C[i].sz); printf("%lld\n", res); return 0; }

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

art.cpp: In function 'int main()':
art.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
art.cpp:16:31: 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", &C[i].sz, &C[i].val);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...