제출 #1275645

#제출 시각아이디문제언어결과실행 시간메모리
1275645monaxia송금 (JOI19_remittance)C++20
0 / 100
1 ms580 KiB
#include <bits/stdc++.h> #include <ext/random> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> // #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define pb push_back #define ppb pop_back #define fr first #define sc second #define all(v) v.begin(), v.end() #define vektor vector using namespace std; // using namespace __gnu_pbds; using ll = long long; using ull = unsigned long long; using ld = long double; constexpr ull Mod = 1e9 + 7; constexpr ull Mod2 = 1 + 7 * 17 * (1 << 23); constexpr ull sqr = 320; constexpr ld eps = 1e-9; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll random(ll l, ll r) {if(l <= r) return uniform_int_distribution <ll> (l, r)(rng); return -1;} ll a[1000005], b[1000005]; void solve(){ int n; cin >> n; priority_queue <pair <int, int>> pq; for(int i = 1; i <= n; i ++) { cin >> a[i] >> b[i]; a[i] -= b[i]; } while(true){ bool b = 0; for(int i = 1; i <= n; i ++){ if(a[i] <= 0) continue; ll val = a[i] - a[i] / 2; a[i] -= (val << 1); if(i == n) a[1] += val, b = 1; else a[i + 1] += val; } if(!b) break; } for(int i = 1; i <= n; i ++){ if(a[i] != 0){ cout << "No"; return; } } cout << "Yes"; } int main(){ // cout << 1; return 0; ios_base::sync_with_stdio(false); cin.tie(NULL); if(fopen("TABLE.inp", "r")){ freopen("TABLE.inp", "r", stdin); freopen("TABLE.out", "w", stdout); } ll t = 1; // cin >> t; while(t --){ solve(); cout << "\n"; } cerr << "Code time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; } // Whose eyes are those eyes?

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

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