제출 #48459

#제출 시각아이디문제언어결과실행 시간메모리
48459arman_ferdousArt Exhibition (JOI18_art)C++17
0 / 100
2 ms380 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 5e5+10; pair<ll,ll> arr[N]; int main() { int n; scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%lld %lld", &arr[i].first, &arr[i].second); sort(arr,arr+n); ll ans = 0, sum = 0; for(int i = 0; i < n; i++) { sum += arr[i].second; ans = max(ans, sum - arr[i].first + arr[0].first); } for(int i = 0; i < n; i++) ans = max(ans, arr[i].second); printf("%lld", 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:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld", &arr[i].first, &arr[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...