제출 #48465

#제출 시각아이디문제언어결과실행 시간메모리
48465arman_ferdousArt Exhibition (JOI18_art)C++17
50 / 100
1083 ms24444 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;
	for(int i = 0; i < n; i++) {
		ll sum = 0;
		for(int j = i; j < n; j++) {
			sum += arr[j].second;
			ans = max(ans, sum - arr[j].first + arr[i].first);
		}
	}
	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...