제출 #460756

#제출 시각아이디문제언어결과실행 시간메모리
460756mahmoudbadawyArt Exhibition (JOI18_art)C++17
100 / 100
257 ms20836 KiB
#include <bits/stdc++.h> #define F first #define S second using namespace std; const int N=5e5+5; pair<long long,long long> arr[N]; int n; int main() { scanf("%d",&n); for(int i=0;i<n;i++) scanf("%lld %lld",&arr[i].F,&arr[i].S); sort(arr,arr+n); long long cur=(1LL<<60),sum=0,ans=0; for(int i=0;i<n;i++) { cur=min(cur,sum-arr[i].F); sum+=arr[i].S; ans=max(ans,sum-arr[i].F-cur); } printf("%lld\n",ans); }

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

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