제출 #754319

#제출 시각아이디문제언어결과실행 시간메모리
754319KN200711Art Exhibition (JOI18_art)C++14
100 / 100
206 ms20764 KiB
# include <bits/stdc++.h>
# define ll long long
# define fi first
# define se second
using namespace std;

int main() {
	int N;
	scanf("%d", &N);
	
	vector< pair<ll, ll> > arr(N);
	for(int i=0;i<N;i++) scanf("%lld %lld", &arr[i].fi, &arr[i].se);
	
	sort(arr.begin(), arr.end());
	ll mn = 1e18, pref = 0ll, ans = 0ll;
	for(int i=0;i<N;i++) {
		mn = min(mn, pref - 1ll * arr[i].fi);
		pref += arr[i].se;
		ans = max(ans, pref - arr[i].fi - mn);
	}
	printf("%lld\n", ans);
}

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

art.cpp: In function 'int main()':
art.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &N);
      |  ~~~~~^~~~~~~~~~
art.cpp:12:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  for(int i=0;i<N;i++) scanf("%lld %lld", &arr[i].fi, &arr[i].se);
      |                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...