제출 #1363840

#제출 시각아이디문제언어결과실행 시간메모리
1363840nanaseyuzuki송금 (JOI19_remittance)C++20
100 / 100
295 ms8260 KiB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define all(a) a.begin(), a.end()
using namespace std;

#ifdef LOCAL
#include "C:\Users\Dell\Downloads\template\template\icpc-notebook\Utilities\debug.h"
#else
#define debug(...) 42
#endif

const int mn = 1e6 + 5, mod = 1e9 + 7, inf = 2e9;

int n, a[mn], b[mn];

void solve() {
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    for(int j = 1; j <= 60; j++) {
    	for(int i = 0; i < n; i++) {
    		if(a[i] > b[i]) {
    			int val = min(a[i], a[i] - b[i] + 1) / 2;
    			a[i] -= val * 2;
    			a[(i + 1) % n] += val;
    		}
    	}
    }
    for(int i = 0; i < n; i++) {
    	if(a[i] != b[i]) {
    		cout << "No\n";
    		return;
    	}
    }
    cout << "Yes\n";
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    #define task "Kawabata"
    if (fopen(task".INP", "r")) {
        freopen(task".INP", "r", stdin);
        freopen(task".OUT", "w", stdout);
    }
    int t = 1;
    // cin >> t;
    while (t--) solve();
    return 0;
}
// Don't wanna lose anymore T_T
// Never let me go - Kazuo Ishiguro

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

remittance.cpp: In function 'int main()':
remittance.cpp:45:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |         freopen(task".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
remittance.cpp:46:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |         freopen(task".OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…