답안 #201292

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
201292 2020-02-10T06:24:30 Z abil Art Exhibition (JOI18_art) C++14
0 / 100
5 ms 376 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_back
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define int long long

using namespace std;

const int N = (1e6 + 12);
const int mod = (1e9 + 7);
const int inf = (1e9 + 7);

pair<int,int > a[N];

main(){
	int n;
	cin >> n;
	for(int i = 1;i <= n; i++){
		scanf("%lld%lld", &a[i].fr, &a[i].sc);
	}
	sort(a + 1,a + 1 + n);
	int ans = 0, sum = a[1].fr;
	for(int i = 1;i <= n; i++){
		sum += a[i].sc;
		ans = max(ans, sum - a[i].fr);
	}
	cout << ans;
}

Compilation message

art.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
art.cpp: In function 'int main()':
art.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", &a[i].fr, &a[i].sc);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -