Submission #579409

# Submission time Handle Problem Language Result Execution time Memory
579409 2022-06-19T05:30:02 Z 장태환(#8353) Remittance (JOI19_remittance) C++17
0 / 100
1 ms 312 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mi[100100];
int arr[100100];
signed main()
{
	int N;
	cin >> N;
	int i;
	for(i=0;i<N;i++)
	{
		int a, b;
		cin >> a >> b;
		mi[i] = a-b;
	}
	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 *=pow(2,N)/(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 d;
	}
	cout << "No";
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:48:7: warning: unused variable 'd' [-Wunused-variable]
   48 |   int d;
      |       ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 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 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 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 Incorrect 1 ms 212 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 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 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 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 Incorrect 1 ms 212 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 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 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 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 Incorrect 1 ms 212 KB Output isn't correct
21 Halted 0 ms 0 KB -