Submission #127260

# Submission time Handle Problem Language Result Execution time Memory
127260 2019-07-09T07:34:38 Z hungcung Art Exhibition (JOI18_art) C++17
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
long long n,sum[500005],ans=INT_MIN;
pair<long long,long long> a[500005];
int main(){
	scanf("%lld",&n);
	for(long long i=1;i<=n;i++){
		scanf("%lld %lld",&a[i].first,&a[i].second);
	}
	sort(a+1,a+n+1);
	for(long long i=1;i<=n;i++){
		sum[i]=sum[i-1]+a[i].second;
	}
	for(long long i=1;i<=n;i++){
		for(long long j=i+1;j<=n;j++){
			if(sum[j]-sum[i-1]-(a[j].first-a[i].first)>ans) ans=sum[j]-sum[i-1]-(a[j].first-a[i].first);
		}
	}
	printf("%lld",ans);
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
art.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld",&a[i].first,&a[i].second);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -