답안 #45127

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
45127 2018-04-11T11:50:35 Z Pajaraja Art Exhibition (JOI18_art) C++17
50 / 100
1000 ms 66344 KB
#include <bits/stdc++.h>
using namespace std;
pair<long long,long long> a[500007];
map<long long,long long> m;
set<long long> s;
int main()
{
	int n,cnt=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		long long t1,t2;
		scanf("%lld%lld",&t1,&t2);
		m[t1]+=t2;
		s.insert(t1);
	}
	while(s.size()>0)
	{
		long long t=*s.begin();
		a[cnt].first=t;
		a[cnt++].second=m[t];
		s.erase(t);
	}
	sort(a,a+cnt);
	long long sum=0,sol=-1000000000000000000LL,minn=1000000000000000000LL;
	for(int i=0;i<cnt;i++)
	{
		minn=fmin(minn,-a[i].first+sum);
		sum+=a[i].second;
		sol=fmax(sol,sum-a[i].first-minn);
	}
	printf("%lld",sol);
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
art.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld",&t1,&t2);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 480 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 532 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 2 ms 560 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 560 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 480 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 532 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 2 ms 560 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 560 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 2 ms 612 KB Output is correct
13 Correct 2 ms 620 KB Output is correct
14 Correct 2 ms 652 KB Output is correct
15 Correct 2 ms 656 KB Output is correct
16 Correct 2 ms 680 KB Output is correct
17 Correct 2 ms 704 KB Output is correct
18 Correct 2 ms 704 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 728 KB Output is correct
21 Correct 2 ms 820 KB Output is correct
22 Correct 2 ms 844 KB Output is correct
23 Correct 2 ms 852 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 3 ms 932 KB Output is correct
26 Correct 2 ms 956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 480 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 532 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 2 ms 560 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 560 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 2 ms 612 KB Output is correct
13 Correct 2 ms 620 KB Output is correct
14 Correct 2 ms 652 KB Output is correct
15 Correct 2 ms 656 KB Output is correct
16 Correct 2 ms 680 KB Output is correct
17 Correct 2 ms 704 KB Output is correct
18 Correct 2 ms 704 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 728 KB Output is correct
21 Correct 2 ms 820 KB Output is correct
22 Correct 2 ms 844 KB Output is correct
23 Correct 2 ms 852 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 3 ms 932 KB Output is correct
26 Correct 2 ms 956 KB Output is correct
27 Correct 8 ms 1604 KB Output is correct
28 Correct 9 ms 1732 KB Output is correct
29 Correct 11 ms 1860 KB Output is correct
30 Correct 8 ms 2004 KB Output is correct
31 Correct 8 ms 2120 KB Output is correct
32 Correct 8 ms 2244 KB Output is correct
33 Correct 8 ms 2372 KB Output is correct
34 Correct 9 ms 2500 KB Output is correct
35 Correct 9 ms 2628 KB Output is correct
36 Correct 8 ms 2864 KB Output is correct
37 Correct 9 ms 2884 KB Output is correct
38 Correct 8 ms 3048 KB Output is correct
39 Correct 8 ms 3156 KB Output is correct
40 Correct 11 ms 3268 KB Output is correct
41 Correct 8 ms 3396 KB Output is correct
42 Correct 8 ms 3648 KB Output is correct
43 Correct 8 ms 3672 KB Output is correct
44 Correct 8 ms 3816 KB Output is correct
45 Correct 8 ms 3952 KB Output is correct
46 Correct 8 ms 4100 KB Output is correct
47 Correct 9 ms 4264 KB Output is correct
48 Correct 10 ms 4292 KB Output is correct
49 Correct 8 ms 4420 KB Output is correct
50 Correct 8 ms 4548 KB Output is correct
51 Correct 8 ms 4804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 480 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 532 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 2 ms 560 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 560 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 2 ms 612 KB Output is correct
13 Correct 2 ms 620 KB Output is correct
14 Correct 2 ms 652 KB Output is correct
15 Correct 2 ms 656 KB Output is correct
16 Correct 2 ms 680 KB Output is correct
17 Correct 2 ms 704 KB Output is correct
18 Correct 2 ms 704 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 728 KB Output is correct
21 Correct 2 ms 820 KB Output is correct
22 Correct 2 ms 844 KB Output is correct
23 Correct 2 ms 852 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 3 ms 932 KB Output is correct
26 Correct 2 ms 956 KB Output is correct
27 Correct 8 ms 1604 KB Output is correct
28 Correct 9 ms 1732 KB Output is correct
29 Correct 11 ms 1860 KB Output is correct
30 Correct 8 ms 2004 KB Output is correct
31 Correct 8 ms 2120 KB Output is correct
32 Correct 8 ms 2244 KB Output is correct
33 Correct 8 ms 2372 KB Output is correct
34 Correct 9 ms 2500 KB Output is correct
35 Correct 9 ms 2628 KB Output is correct
36 Correct 8 ms 2864 KB Output is correct
37 Correct 9 ms 2884 KB Output is correct
38 Correct 8 ms 3048 KB Output is correct
39 Correct 8 ms 3156 KB Output is correct
40 Correct 11 ms 3268 KB Output is correct
41 Correct 8 ms 3396 KB Output is correct
42 Correct 8 ms 3648 KB Output is correct
43 Correct 8 ms 3672 KB Output is correct
44 Correct 8 ms 3816 KB Output is correct
45 Correct 8 ms 3952 KB Output is correct
46 Correct 8 ms 4100 KB Output is correct
47 Correct 9 ms 4264 KB Output is correct
48 Correct 10 ms 4292 KB Output is correct
49 Correct 8 ms 4420 KB Output is correct
50 Correct 8 ms 4548 KB Output is correct
51 Correct 8 ms 4804 KB Output is correct
52 Execution timed out 1082 ms 66344 KB Time limit exceeded
53 Halted 0 ms 0 KB -