Submission #201294

# Submission time Handle Problem Language Result Execution time Memory
201294 2020-02-10T06:25:11 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);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -