답안 #272059

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
272059 2020-08-18T08:30:50 Z okaragul Art Exhibition (JOI18_art) C++17
0 / 100
4 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(){
	#ifndef ONLINE_JUDGE
		freopen("zgir.gir", "r", stdin);
		freopen("zcik.cik", "w", stdout);
	#endif

	lli n;
	cin>>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);
	}
	cout<<cvp<<endl;
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:17:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   17 |   freopen("zgir.gir", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
art.cpp:18:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   18 |   freopen("zcik.cik", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -