답안 #579415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
579415 2022-06-19T05:38:37 Z 장태환(#8353) 송금 (JOI19_remittance) C++17
100 / 100
806 ms 36460 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mi[1000100];
int arr[1000100];
signed main()
{
	int N;
	cin >> N;
	int i;
	int as = 0;
	int bs = 0;
	for(i=0;i<N;i++)
	{
		int a, b;
		cin >> a >> b;
		mi[i] = a-b;
		as += a;
		bs += b;
	}
	if (!bs && as)
	{
		cout << "No";
		return 0;
	}
	double d = 0;
	double mu = 0.5;
	for (i = N-1; i >=0; i--)
	{
		d += mu*mi[i];
		mu *= 0.5;
	}
	if (N < 50)
	{
		d +=d/(pow(2,N)-1);
	}
	i = d - 3;
	for (; i < d+3; i++)
	{
		if (i < 0)
			continue;
		arr[0] = i;
		int j;
		for (j = N - 1; j > 0; j--)
		{
			arr[j] = -mi[j] + 2 * arr[(j+1)%N];
			if (arr[j] < 0)
				goto T;
			if (arr[j] >= (1LL << 60))
				goto T;
		}
		if (arr[0] != -mi[0] + 2 * arr[1])
			goto T;
		cout << "Yes";
		return 0;
		T:
		int x;
	}
	cout << "No";
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:57:7: warning: unused variable 'x' [-Wunused-variable]
   57 |   int x;
      |       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 308 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 308 KB Output is correct
40 Correct 1 ms 308 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 308 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 308 KB Output is correct
55 Correct 1 ms 312 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 312 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 308 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 308 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 308 KB Output is correct
40 Correct 1 ms 308 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 308 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 308 KB Output is correct
55 Correct 1 ms 312 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 312 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 308 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 794 ms 27332 KB Output is correct
64 Correct 279 ms 19772 KB Output is correct
65 Correct 745 ms 34840 KB Output is correct
66 Correct 299 ms 19736 KB Output is correct
67 Correct 317 ms 21228 KB Output is correct
68 Correct 423 ms 23672 KB Output is correct
69 Correct 803 ms 35468 KB Output is correct
70 Correct 274 ms 12060 KB Output is correct
71 Correct 306 ms 19472 KB Output is correct
72 Correct 401 ms 17984 KB Output is correct
73 Correct 806 ms 29304 KB Output is correct
74 Correct 284 ms 17352 KB Output is correct
75 Correct 322 ms 20268 KB Output is correct
76 Correct 422 ms 22044 KB Output is correct
77 Correct 743 ms 35108 KB Output is correct
78 Correct 546 ms 19832 KB Output is correct
79 Correct 586 ms 19760 KB Output is correct
80 Correct 546 ms 27572 KB Output is correct
81 Correct 526 ms 20096 KB Output is correct
82 Correct 281 ms 12020 KB Output is correct
83 Correct 275 ms 11960 KB Output is correct
84 Correct 270 ms 19828 KB Output is correct
85 Correct 768 ms 36460 KB Output is correct
86 Correct 796 ms 30148 KB Output is correct
87 Correct 558 ms 20776 KB Output is correct
88 Correct 552 ms 28728 KB Output is correct