제출 #672132

#제출 시각아이디문제언어결과실행 시간메모리
672132StavabArt Exhibition (JOI18_art)C++14
0 / 100
0 ms212 KiB
#include <iostream> #include <vector> #include <utility> #include <algorithm> using namespace std; int main() { int n; scanf("%d", &n); vector<pair<long long, long long>> v(n); for(int i = 0; i < n; i++) { scanf("%lld", &v[i].first); scanf("%lld", &v[i].second); } sort(v.begin(), v.end()); long long best = -1; long long sum = 0; for(int i = 0; i < n; i++) { sum += v[i].second; best = max(best, sum - v[i].first); } long long temp = 0; sum = 0; for(int i = 0; i < n; i++) { best = max(best, best - sum + v[i].first - temp); sum += v[i].second; temp = v[i].first; } printf("%lld\n", best); return 0; }

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

art.cpp: In function 'int main()':
art.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
art.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%lld", &v[i].first);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~
art.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%lld", &v[i].second);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...