Submission #778908

# Submission time Handle Problem Language Result Execution time Memory
778908 2023-07-11T02:52:55 Z shoryu386 Remittance (JOI19_remittance) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

main(){
	int n; cin >> n;
	
	int a[n], b[n]; for (int x = 0;x < n; x++) cin >> a[x] >> b[x];
	
	#define SUS 40000
	for (int y = 0; y < SUS; y++){
		for (int x = 0; x < n; x++){
			if (a[x] >= b[x] + 2){
				int trans = (a[x] - b[x])/2;
				a[x] -= 2*trans;
				if (x != n-1) a[x+1] += trans;
				else a[0] += trans;
			}
		}
	}
	
	bool wtf = true;
	for (int x = 0; x < n; x++){
		if (a[x] >= b[x] + 2) assert(false);
		
		if (a[x] != b[x]) wtf = false;
	}
	
	if (wtf) cout << "Yes";
	else cout << "No";
}

Compilation message

remittance.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -