Submission #224133

# Submission time Handle Problem Language Result Execution time Memory
224133 2020-04-17T08:43:55 Z bharat2002 Art Exhibition (JOI18_art) C++14
0 / 100
4 ms 384 KB
/*input
3
2 3
11 2
4 5
*/
#include<bits/stdc++.h>
using namespace std;
const int N=5e5 + 100;
const int mod=1e9 + 7;
#define int long long
const int inf=1e18;
#define pii pair<int, int>
#define f first
#define s second 
#define mp make_pair
#define FOR(i, n) for(int i=1;i<=n;i++)
#define TRACE(x) cerr << #x << " = " << x << endl 
//Trace prints the name of the variable and the value.
int n;map<int, int> vals;int pref[N];
bool sf(pii a, pii b)
{
	return a.f<b.f;
}
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int a, b;cin>>a>>b;vals[a]+=b;
	}
	int sum=0;int mval=0, ans=0;
	for(auto i:vals)
	{
		sum+=i.s;
		ans=max(ans, sum + mval - i.f);
		mval=max(mval, i.f - sum + i.s);
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -