답안 #48465

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48465 2018-05-13T18:14:28 Z arman_ferdous Art Exhibition (JOI18_art) C++17
50 / 100
1000 ms 24444 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N = 5e5+10;
pair<ll,ll> arr[N];

int main() {
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%lld %lld", &arr[i].first, &arr[i].second);

	sort(arr,arr+n);
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		ll sum = 0;
		for(int j = i; j < n; j++) {
			sum += arr[j].second;
			ans = max(ans, sum - arr[j].first + arr[i].first);
		}
	}
	printf("%lld", ans);
	return 0;
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
art.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld", &arr[i].first, &arr[i].second);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 608 KB Output is correct
9 Correct 2 ms 608 KB Output is correct
10 Correct 2 ms 608 KB Output is correct
11 Correct 2 ms 608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 608 KB Output is correct
9 Correct 2 ms 608 KB Output is correct
10 Correct 2 ms 608 KB Output is correct
11 Correct 2 ms 608 KB Output is correct
12 Correct 2 ms 608 KB Output is correct
13 Correct 2 ms 608 KB Output is correct
14 Correct 2 ms 644 KB Output is correct
15 Correct 2 ms 668 KB Output is correct
16 Correct 2 ms 692 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 2 ms 756 KB Output is correct
19 Correct 2 ms 892 KB Output is correct
20 Correct 2 ms 892 KB Output is correct
21 Correct 2 ms 892 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 2 ms 892 KB Output is correct
24 Correct 2 ms 892 KB Output is correct
25 Correct 2 ms 892 KB Output is correct
26 Correct 2 ms 900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 608 KB Output is correct
9 Correct 2 ms 608 KB Output is correct
10 Correct 2 ms 608 KB Output is correct
11 Correct 2 ms 608 KB Output is correct
12 Correct 2 ms 608 KB Output is correct
13 Correct 2 ms 608 KB Output is correct
14 Correct 2 ms 644 KB Output is correct
15 Correct 2 ms 668 KB Output is correct
16 Correct 2 ms 692 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 2 ms 756 KB Output is correct
19 Correct 2 ms 892 KB Output is correct
20 Correct 2 ms 892 KB Output is correct
21 Correct 2 ms 892 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 2 ms 892 KB Output is correct
24 Correct 2 ms 892 KB Output is correct
25 Correct 2 ms 892 KB Output is correct
26 Correct 2 ms 900 KB Output is correct
27 Correct 21 ms 1036 KB Output is correct
28 Correct 22 ms 1236 KB Output is correct
29 Correct 22 ms 1292 KB Output is correct
30 Correct 22 ms 1472 KB Output is correct
31 Correct 22 ms 1548 KB Output is correct
32 Correct 22 ms 1728 KB Output is correct
33 Correct 22 ms 1776 KB Output is correct
34 Correct 22 ms 2088 KB Output is correct
35 Correct 22 ms 2088 KB Output is correct
36 Correct 22 ms 2192 KB Output is correct
37 Correct 22 ms 2368 KB Output is correct
38 Correct 22 ms 2416 KB Output is correct
39 Correct 22 ms 2584 KB Output is correct
40 Correct 22 ms 2696 KB Output is correct
41 Correct 21 ms 2832 KB Output is correct
42 Correct 22 ms 3012 KB Output is correct
43 Correct 22 ms 3084 KB Output is correct
44 Correct 22 ms 3212 KB Output is correct
45 Correct 21 ms 3340 KB Output is correct
46 Correct 21 ms 3520 KB Output is correct
47 Correct 22 ms 3604 KB Output is correct
48 Correct 21 ms 3724 KB Output is correct
49 Correct 21 ms 3856 KB Output is correct
50 Correct 22 ms 4036 KB Output is correct
51 Correct 22 ms 4216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 608 KB Output is correct
9 Correct 2 ms 608 KB Output is correct
10 Correct 2 ms 608 KB Output is correct
11 Correct 2 ms 608 KB Output is correct
12 Correct 2 ms 608 KB Output is correct
13 Correct 2 ms 608 KB Output is correct
14 Correct 2 ms 644 KB Output is correct
15 Correct 2 ms 668 KB Output is correct
16 Correct 2 ms 692 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 2 ms 756 KB Output is correct
19 Correct 2 ms 892 KB Output is correct
20 Correct 2 ms 892 KB Output is correct
21 Correct 2 ms 892 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 2 ms 892 KB Output is correct
24 Correct 2 ms 892 KB Output is correct
25 Correct 2 ms 892 KB Output is correct
26 Correct 2 ms 900 KB Output is correct
27 Correct 21 ms 1036 KB Output is correct
28 Correct 22 ms 1236 KB Output is correct
29 Correct 22 ms 1292 KB Output is correct
30 Correct 22 ms 1472 KB Output is correct
31 Correct 22 ms 1548 KB Output is correct
32 Correct 22 ms 1728 KB Output is correct
33 Correct 22 ms 1776 KB Output is correct
34 Correct 22 ms 2088 KB Output is correct
35 Correct 22 ms 2088 KB Output is correct
36 Correct 22 ms 2192 KB Output is correct
37 Correct 22 ms 2368 KB Output is correct
38 Correct 22 ms 2416 KB Output is correct
39 Correct 22 ms 2584 KB Output is correct
40 Correct 22 ms 2696 KB Output is correct
41 Correct 21 ms 2832 KB Output is correct
42 Correct 22 ms 3012 KB Output is correct
43 Correct 22 ms 3084 KB Output is correct
44 Correct 22 ms 3212 KB Output is correct
45 Correct 21 ms 3340 KB Output is correct
46 Correct 21 ms 3520 KB Output is correct
47 Correct 22 ms 3604 KB Output is correct
48 Correct 21 ms 3724 KB Output is correct
49 Correct 21 ms 3856 KB Output is correct
50 Correct 22 ms 4036 KB Output is correct
51 Correct 22 ms 4216 KB Output is correct
52 Execution timed out 1083 ms 24444 KB Time limit exceeded
53 Halted 0 ms 0 KB -