답안 #321267

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
321267 2020-11-11T19:32:50 Z CaroLinda 송금 (JOI19_remittance) C++14
100 / 100
710 ms 36484 KB
#include <bits/stdc++.h>

const int MAX = 1e6+10 ;

using namespace std ;

int n ;
long long cash[MAX] , desired[MAX] ;

int main()
{
	scanf("%d", &n ) ;

	for(int i= 0 ; i < n ; i++ ) scanf("%lld %lld", &cash[i] , &desired[i] ) ;

	for(int g = 0 ; g < 60 ; g++ )
	{
		for(int i= 0 , nxt = 1 ; i < n ; i++ , nxt++ )
		{
			if(nxt == n) nxt = 0 ;

			long long leftOver = cash[i] - desired[i] ;

			if(leftOver < 0 ) continue ;

			leftOver++ ;

			if(cash[i]-(leftOver/2LL)*2LL < 0LL ) continue ;

			cash[i] -= (leftOver/2LL ) *2LL ;
			cash[nxt] += leftOver/2LL ;

		}
	}

	bool ok =true ;

	for(int i= 0 ; i < n ; i++ )
		if(cash[i] != desired[i] ) ok = false ;

	if(ok) printf("Yes\n") ;
	else printf("No\n") ;

}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |  scanf("%d", &n ) ;
      |  ~~~~~^~~~~~~~~~~
remittance.cpp:14:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |  for(int i= 0 ; i < n ; i++ ) scanf("%lld %lld", &cash[i] , &desired[i] ) ;
      |                               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 376 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 376 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 376 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 376 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 0 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 0 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 1 ms 364 KB Output is correct
47 Correct 0 ms 364 KB Output is correct
48 Correct 0 ms 364 KB Output is correct
49 Correct 1 ms 364 KB Output is correct
50 Correct 0 ms 364 KB Output is correct
51 Correct 1 ms 364 KB Output is correct
52 Correct 1 ms 364 KB Output is correct
53 Correct 0 ms 364 KB Output is correct
54 Correct 1 ms 364 KB Output is correct
55 Correct 1 ms 364 KB Output is correct
56 Correct 1 ms 364 KB Output is correct
57 Correct 1 ms 364 KB Output is correct
58 Correct 1 ms 364 KB Output is correct
59 Correct 0 ms 364 KB Output is correct
60 Correct 1 ms 364 KB Output is correct
61 Correct 1 ms 364 KB Output is correct
62 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 376 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 376 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 0 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 0 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 1 ms 364 KB Output is correct
47 Correct 0 ms 364 KB Output is correct
48 Correct 0 ms 364 KB Output is correct
49 Correct 1 ms 364 KB Output is correct
50 Correct 0 ms 364 KB Output is correct
51 Correct 1 ms 364 KB Output is correct
52 Correct 1 ms 364 KB Output is correct
53 Correct 0 ms 364 KB Output is correct
54 Correct 1 ms 364 KB Output is correct
55 Correct 1 ms 364 KB Output is correct
56 Correct 1 ms 364 KB Output is correct
57 Correct 1 ms 364 KB Output is correct
58 Correct 1 ms 364 KB Output is correct
59 Correct 0 ms 364 KB Output is correct
60 Correct 1 ms 364 KB Output is correct
61 Correct 1 ms 364 KB Output is correct
62 Correct 0 ms 364 KB Output is correct
63 Correct 611 ms 35300 KB Output is correct
64 Correct 417 ms 20068 KB Output is correct
65 Correct 520 ms 34916 KB Output is correct
66 Correct 415 ms 19940 KB Output is correct
67 Correct 435 ms 21220 KB Output is correct
68 Correct 434 ms 23780 KB Output is correct
69 Correct 518 ms 35428 KB Output is correct
70 Correct 413 ms 19884 KB Output is correct
71 Correct 421 ms 21356 KB Output is correct
72 Correct 428 ms 23652 KB Output is correct
73 Correct 528 ms 35544 KB Output is correct
74 Correct 422 ms 19876 KB Output is correct
75 Correct 423 ms 21328 KB Output is correct
76 Correct 433 ms 23780 KB Output is correct
77 Correct 374 ms 35428 KB Output is correct
78 Correct 688 ms 27748 KB Output is correct
79 Correct 710 ms 27748 KB Output is correct
80 Correct 459 ms 27640 KB Output is correct
81 Correct 335 ms 27620 KB Output is correct
82 Correct 287 ms 20068 KB Output is correct
83 Correct 265 ms 20068 KB Output is correct
84 Correct 418 ms 19940 KB Output is correct
85 Correct 529 ms 36484 KB Output is correct
86 Correct 524 ms 36448 KB Output is correct
87 Correct 410 ms 28644 KB Output is correct
88 Correct 477 ms 28648 KB Output is correct