Submission #335091

# Submission time Handle Problem Language Result Execution time Memory
335091 2020-12-11T06:22:26 Z Mo_TOI_I_am_Garbage Remittance (JOI19_remittance) C++14
0 / 100
1 ms 364 KB
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a; cin >> a;
	pair<int, int> arr[a + 50];
	for(int i=0; i < a; i ++)
		cin >> arr[i].first >> arr[i].second;
	while(true)
	{
		bool yes = false;
		for(int i=0; i < a; i ++)
		{
			if(arr[i].first < arr[i].second + 2) continue;
			int t = arr[i].first - arr[i].second;
			arr[i].first -= t * 2;
			if(i == a - 1) arr[0].first += t;
			else		   arr[i + 1].first += t;
			yes = true;
		}
		if(!yes) break;
	}
	bool yes1 = true, yes2 = true;
	for(int i=0; i < a; i ++)
	{
		if(arr[i].first != arr[i].second) yes1 = false;
		if(arr[i].first != arr[i].second + 1 || arr[i].first < 2) yes2 = false;
	}
	if(yes1 || yes2) cout << "Yes";
	else			 cout << "No";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -