답안 #127317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
127317 2019-07-09T08:22:58 Z TienDungz Art Exhibition (JOI18_art) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
#define int long long
#pragma O3
#pragma Ofast
#pragma O3("optimize")
using namespace std;
typedef pair<int,int> ii;
int n,u,v;
vector<ii> adj;
int tmp=99999999999,res=99999999999,sum=0;
signed main()
{
	ios_base::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>u>>v;
		adj.push_back(ii(u,v));
		sum+=v;
	}
	sort(adj.begin(),adj.end());
	for(int i=0;i<n;i++)
	{
		tmp=max(tmp,adj[i].first-sum);
		sum+=adj[i].second;
		res=max(res,sum+tmp-adj[i].first);
	}
	cout<<res;
}

Compilation message

art.cpp:3:0: warning: ignoring #pragma O3  [-Wunknown-pragmas]
 #pragma O3
 
art.cpp:4:0: warning: ignoring #pragma Ofast  [-Wunknown-pragmas]
 #pragma Ofast
 
art.cpp:5:0: warning: ignoring #pragma O3  [-Wunknown-pragmas]
 #pragma O3("optimize")
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -