Submission #134239

# Submission time Handle Problem Language Result Execution time Memory
134239 2019-07-22T08:57:13 Z Boxworld Art Exhibition (JOI18_art) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN=500010;
struct art{ll size,val;}a[maxN];
bool cmp(art x,art y){return x.size<y.size;}
ll ans=0,val=0;
int main(){
	int n;
	scanf("%d",&n);
	for (int i=0;i<n;i++)scanf("%lld%lld",&a[i].size,&a[i].val);
	sort(a,a+n,cmp);
	for (int i=0;i<n;i++){
		val+=a[i].val;
		ans=max(ans,val+a[0].size-a[i].size);
	}
	printf("%lld\n",ans);
}

Compilation message

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:11:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i=0;i<n;i++)scanf("%lld%lld",&a[i].size,&a[i].val);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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 -