Submission #942362

# Submission time Handle Problem Language Result Execution time Memory
942362 2024-03-10T13:44:22 Z dshfjka Remittance (JOI19_remittance) C++14
100 / 100
611 ms 36284 KB
#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL maks=1e8;
int main()
{
	LL n;
	scanf("%lld",&n);
	LL arr[n+5],brr[n+5];
	for(LL a=0;a<n;a++)
	{
		scanf("%lld %lld",&arr[a],&brr[a]);
	}
	for(LL a=1;a<=maks/n;a++)
	{
		for(LL b=0;b<n;b++)
		{
			if(arr[b]>brr[b])
			{
				LL diff=arr[b]-brr[b];
				
				if(diff&1)diff++;
				if((brr[b]==0) && (arr[b]&1))diff-=2;
			//	printf("%lld : diff=%lld\n",b,diff);
				arr[b]-=diff;
				arr[(b+1)%n]+=(diff/2);
			//	printf("arr[%lld] = %lld\n",b,arr[b]);
			//	printf("arr[%lld] = %lld dan arr[%lld] = %lld\n",b,arr[b],(b+1)%n,arr[(b+1)%n]);
			}
		}
	}
//	printf("SINI\n");
	for(LL a=0;a<n;a++)
	{
	//	printf("%lld dan %lld\n",arr[a],brr[a]);
		if(arr[a]!=brr[a])
		{
			printf("No\n");
			exit(0);
		}
	}
	printf("Yes\n");
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
remittance.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%lld %lld",&arr[a],&brr[a]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 64 ms 344 KB Output is correct
2 Correct 85 ms 348 KB Output is correct
3 Correct 89 ms 344 KB Output is correct
4 Correct 76 ms 404 KB Output is correct
5 Correct 71 ms 408 KB Output is correct
6 Correct 61 ms 412 KB Output is correct
7 Correct 60 ms 344 KB Output is correct
8 Correct 89 ms 348 KB Output is correct
9 Correct 66 ms 348 KB Output is correct
10 Correct 65 ms 404 KB Output is correct
11 Correct 61 ms 348 KB Output is correct
12 Correct 91 ms 348 KB Output is correct
13 Correct 85 ms 348 KB Output is correct
14 Correct 68 ms 404 KB Output is correct
15 Correct 77 ms 344 KB Output is correct
16 Correct 222 ms 344 KB Output is correct
17 Correct 112 ms 348 KB Output is correct
18 Correct 77 ms 344 KB Output is correct
19 Correct 81 ms 404 KB Output is correct
20 Correct 437 ms 408 KB Output is correct
21 Correct 435 ms 404 KB Output is correct
22 Correct 82 ms 344 KB Output is correct
23 Correct 381 ms 348 KB Output is correct
24 Correct 59 ms 348 KB Output is correct
25 Correct 61 ms 412 KB Output is correct
26 Correct 437 ms 408 KB Output is correct
27 Correct 62 ms 348 KB Output is correct
28 Correct 64 ms 408 KB Output is correct
29 Correct 63 ms 596 KB Output is correct
30 Correct 64 ms 408 KB Output is correct
31 Correct 436 ms 408 KB Output is correct
32 Correct 70 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 344 KB Output is correct
2 Correct 85 ms 348 KB Output is correct
3 Correct 89 ms 344 KB Output is correct
4 Correct 76 ms 404 KB Output is correct
5 Correct 71 ms 408 KB Output is correct
6 Correct 61 ms 412 KB Output is correct
7 Correct 60 ms 344 KB Output is correct
8 Correct 89 ms 348 KB Output is correct
9 Correct 66 ms 348 KB Output is correct
10 Correct 65 ms 404 KB Output is correct
11 Correct 61 ms 348 KB Output is correct
12 Correct 91 ms 348 KB Output is correct
13 Correct 85 ms 348 KB Output is correct
14 Correct 68 ms 404 KB Output is correct
15 Correct 77 ms 344 KB Output is correct
16 Correct 222 ms 344 KB Output is correct
17 Correct 112 ms 348 KB Output is correct
18 Correct 77 ms 344 KB Output is correct
19 Correct 81 ms 404 KB Output is correct
20 Correct 437 ms 408 KB Output is correct
21 Correct 435 ms 404 KB Output is correct
22 Correct 82 ms 344 KB Output is correct
23 Correct 381 ms 348 KB Output is correct
24 Correct 59 ms 348 KB Output is correct
25 Correct 61 ms 412 KB Output is correct
26 Correct 437 ms 408 KB Output is correct
27 Correct 62 ms 348 KB Output is correct
28 Correct 64 ms 408 KB Output is correct
29 Correct 63 ms 596 KB Output is correct
30 Correct 64 ms 408 KB Output is correct
31 Correct 436 ms 408 KB Output is correct
32 Correct 70 ms 600 KB Output is correct
33 Correct 48 ms 408 KB Output is correct
34 Correct 43 ms 348 KB Output is correct
35 Correct 49 ms 412 KB Output is correct
36 Correct 87 ms 344 KB Output is correct
37 Correct 50 ms 416 KB Output is correct
38 Correct 89 ms 344 KB Output is correct
39 Correct 76 ms 344 KB Output is correct
40 Correct 44 ms 344 KB Output is correct
41 Correct 48 ms 344 KB Output is correct
42 Correct 89 ms 416 KB Output is correct
43 Correct 72 ms 344 KB Output is correct
44 Correct 45 ms 348 KB Output is correct
45 Correct 58 ms 412 KB Output is correct
46 Correct 85 ms 348 KB Output is correct
47 Correct 72 ms 344 KB Output is correct
48 Correct 47 ms 344 KB Output is correct
49 Correct 45 ms 344 KB Output is correct
50 Correct 435 ms 592 KB Output is correct
51 Correct 436 ms 348 KB Output is correct
52 Correct 225 ms 412 KB Output is correct
53 Correct 416 ms 348 KB Output is correct
54 Correct 49 ms 348 KB Output is correct
55 Correct 49 ms 348 KB Output is correct
56 Correct 436 ms 420 KB Output is correct
57 Correct 48 ms 344 KB Output is correct
58 Correct 45 ms 348 KB Output is correct
59 Correct 46 ms 344 KB Output is correct
60 Correct 45 ms 348 KB Output is correct
61 Correct 435 ms 416 KB Output is correct
62 Correct 50 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 344 KB Output is correct
2 Correct 85 ms 348 KB Output is correct
3 Correct 89 ms 344 KB Output is correct
4 Correct 76 ms 404 KB Output is correct
5 Correct 71 ms 408 KB Output is correct
6 Correct 61 ms 412 KB Output is correct
7 Correct 60 ms 344 KB Output is correct
8 Correct 89 ms 348 KB Output is correct
9 Correct 66 ms 348 KB Output is correct
10 Correct 65 ms 404 KB Output is correct
11 Correct 61 ms 348 KB Output is correct
12 Correct 91 ms 348 KB Output is correct
13 Correct 85 ms 348 KB Output is correct
14 Correct 68 ms 404 KB Output is correct
15 Correct 77 ms 344 KB Output is correct
16 Correct 222 ms 344 KB Output is correct
17 Correct 112 ms 348 KB Output is correct
18 Correct 77 ms 344 KB Output is correct
19 Correct 81 ms 404 KB Output is correct
20 Correct 437 ms 408 KB Output is correct
21 Correct 435 ms 404 KB Output is correct
22 Correct 82 ms 344 KB Output is correct
23 Correct 381 ms 348 KB Output is correct
24 Correct 59 ms 348 KB Output is correct
25 Correct 61 ms 412 KB Output is correct
26 Correct 437 ms 408 KB Output is correct
27 Correct 62 ms 348 KB Output is correct
28 Correct 64 ms 408 KB Output is correct
29 Correct 63 ms 596 KB Output is correct
30 Correct 64 ms 408 KB Output is correct
31 Correct 436 ms 408 KB Output is correct
32 Correct 70 ms 600 KB Output is correct
33 Correct 48 ms 408 KB Output is correct
34 Correct 43 ms 348 KB Output is correct
35 Correct 49 ms 412 KB Output is correct
36 Correct 87 ms 344 KB Output is correct
37 Correct 50 ms 416 KB Output is correct
38 Correct 89 ms 344 KB Output is correct
39 Correct 76 ms 344 KB Output is correct
40 Correct 44 ms 344 KB Output is correct
41 Correct 48 ms 344 KB Output is correct
42 Correct 89 ms 416 KB Output is correct
43 Correct 72 ms 344 KB Output is correct
44 Correct 45 ms 348 KB Output is correct
45 Correct 58 ms 412 KB Output is correct
46 Correct 85 ms 348 KB Output is correct
47 Correct 72 ms 344 KB Output is correct
48 Correct 47 ms 344 KB Output is correct
49 Correct 45 ms 344 KB Output is correct
50 Correct 435 ms 592 KB Output is correct
51 Correct 436 ms 348 KB Output is correct
52 Correct 225 ms 412 KB Output is correct
53 Correct 416 ms 348 KB Output is correct
54 Correct 49 ms 348 KB Output is correct
55 Correct 49 ms 348 KB Output is correct
56 Correct 436 ms 420 KB Output is correct
57 Correct 48 ms 344 KB Output is correct
58 Correct 45 ms 348 KB Output is correct
59 Correct 46 ms 344 KB Output is correct
60 Correct 45 ms 348 KB Output is correct
61 Correct 435 ms 416 KB Output is correct
62 Correct 50 ms 348 KB Output is correct
63 Correct 259 ms 35252 KB Output is correct
64 Correct 189 ms 19764 KB Output is correct
65 Correct 278 ms 34776 KB Output is correct
66 Correct 194 ms 19892 KB Output is correct
67 Correct 199 ms 21332 KB Output is correct
68 Correct 213 ms 23724 KB Output is correct
69 Correct 262 ms 35388 KB Output is correct
70 Correct 210 ms 19796 KB Output is correct
71 Correct 210 ms 21328 KB Output is correct
72 Correct 228 ms 23636 KB Output is correct
73 Correct 261 ms 35248 KB Output is correct
74 Correct 207 ms 19796 KB Output is correct
75 Correct 217 ms 21368 KB Output is correct
76 Correct 249 ms 23636 KB Output is correct
77 Correct 254 ms 35252 KB Output is correct
78 Correct 611 ms 27820 KB Output is correct
79 Correct 594 ms 27696 KB Output is correct
80 Correct 239 ms 27476 KB Output is correct
81 Correct 235 ms 27836 KB Output is correct
82 Correct 567 ms 19980 KB Output is correct
83 Correct 202 ms 20144 KB Output is correct
84 Correct 186 ms 19792 KB Output is correct
85 Correct 273 ms 36284 KB Output is correct
86 Correct 266 ms 36276 KB Output is correct
87 Correct 595 ms 29008 KB Output is correct
88 Correct 227 ms 28744 KB Output is correct