제출 #1298283

#제출 시각아이디문제언어결과실행 시간메모리
1298283daotuankhoi송금 (JOI19_remittance)C++20
0 / 100
1 ms576 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define ll long long #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif template <class T> bool ckmax(T &a, T b) { return a < b ? (a = b, true) : false; } template <class T> bool ckmin(T &a, T b) { return a > b ? (a = b, true) : false; } const int MAXN = 1e6 + 5; int a[MAXN], b[MAXN]; int main() { #define NAME "test" if (fopen(NAME".inp", "r")) { freopen(NAME".inp", "r", stdin); freopen(NAME".out", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } for (int i = 0; i < n; i++) { int rem = a[i] - b[i]; if (rem <= 0) continue; if (rem & 1) rem--; a[i] -= rem; a[(i + 1) % n] += rem / 2; } for (int i = 0; i < n; i++) { int rem = a[i] - b[i]; if (rem <= 0) continue; if (rem & 1) rem--; a[i] -= rem; a[(i + 1) % n] += rem / 2; } for (int i = 0; i < n; i++) { if (a[i] != b[i]) return cout << "No\n", 0; } cout << "Yes\n"; return 0; }

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

remittance.cpp: In function 'int main()':
remittance.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen(NAME".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
remittance.cpp:24:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         freopen(NAME".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...