Submission #272071

# Submission time Handle Problem Language Result Execution time Memory
272071 2020-08-18T08:35:20 Z okaragul Art Exhibition (JOI18_art) C++17
0 / 100
3 ms 640 KB
#include<bits/stdc++.h>
using namespace std;

#define lli long long
#define INF LONG_LONG_MAX
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define endl '\n'
#define max(aa, bb) (aa > bb ? aa:bb)
#define min(aa, bb) (aa < bb ? aa:bb)
#define all(aa) aa.begin(), aa.end()

int main(){
	lli n;
	scanf("%d", &n);
	
	vector<pair<lli,lli>>v(n);
	for(auto &it:v){
		cin>>it.st>>it.nd;
	}

	sort(all(v));

	lli tmp=v[0].nd, cvp=0;

	for(lli i=1;i<n;i++){
		tmp=max(tmp-v[i].st+v[i-1].st+v[i].nd, v[i].nd);
		cvp=max(cvp, tmp);
	}
	printf("%d", cvp);
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:17:10: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   17 |  scanf("%d", &n);
      |         ~^   ~~
      |          |   |
      |          |   long long int*
      |          int*
      |         %lld
art.cpp:32:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   32 |  printf("%d", cvp);
      |          ~^   ~~~
      |           |   |
      |           int long long int
      |          %lld
art.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -