Submission #60391

#TimeUsernameProblemLanguageResultExecution timeMemory
60391gusfringArt Exhibition (JOI18_art)C++14
50 / 100
39 ms4656 KiB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 5e3 + 5;
typedef long long ll;
#define sz first
#define val second

pair<ll, ll> C[MAXN];
int N;

int main(){
	scanf("%d", &N);
	for(int i=1; i<=N; ++i) scanf("%lld %lld", &C[i].sz, &C[i].val);
	sort(C + 1, C + N + 1);
	ll res = 0;
	for(int i=1; i<=N; ++i){
		ll sum = 0;
		for(int j=i; j<=N; ++j){
			sum += C[j].val;
			res = max(res, sum - (C[j].sz - C[i].sz));
		}
	}
	printf("%lld\n", res);
	return 0;
}
			

Compilation message (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]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
art.cpp:15:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=N; ++i) scanf("%lld %lld", &C[i].sz, &C[i].val);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...