제출 #779613

#제출 시각아이디문제언어결과실행 시간메모리
779613shoryu386송금 (JOI19_remittance)C++17
100 / 100
639 ms36260 KiB
#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 40
	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 {
		
		bool crying = true;
		bool AaaaaAA = false;
		for (int x = 0; x < n; x++){
			if (a[x] != b[x]+1) crying = false;
			if (a[x] > 1) AaaaaAA = true;
		}
		
		if (AaaaaAA && crying) cout << "Yes";
		else {
			cout << "No";
		}
	}
}

컴파일 시 표준 에러 (stderr) 메시지

remittance.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...