Submission #972255

# Submission time Handle Problem Language Result Execution time Memory
972255 2024-04-30T10:05:03 Z vjudge1 Art Exhibition (JOI18_art) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h> 
#include <sstream> 
using namespace std; 
#define accepted ios_base::sync_with_stdio(false);cin.tie(nullptr); 
#define Daulbekov signed     
#define Makan main 
#define int long long 
#define double long double 
#define pb push_back 
#define pf push_front 
#define F first 
#define S second 
const int N=1e5+7; 
const int MAX=9e18+7; 
const int INF=1e18;
Daulbekov Makan(){
	int n;
	cin>>n;
	pair<int,int>a[n];
	int vozmozhno=0;
	for(int i=0;i<n;i++){
		cin>>a[i].F>>a[i].S;
		vozmozhno=max(vozmozhno,a[i].S);
	}
	sort(a,a+n);
	int mx=a[0].S,col=a[0].S;
	bool b=1;
	for(int i=1;i<n;i++){
		if(b==0){
			b=1;
			col+=a[i].S;
			mx=max(mx,col);
			continue;
		}
		col+=a[i].S;
		col-=(a[i].F-a[i-1].F);
		if(col<0){
			col=0;
			b=0;
		}
		mx=max(mx,col);
	}
	cout<<max(mx,vozmozhno);
} 
// 2 3
// 4 5
// 11 2
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -