제출 #1259714

#제출 시각아이디문제언어결과실행 시간메모리
1259714_rain_Remittance (JOI19_remittance)C++20
0 / 100
1 ms328 KiB
#include<bits/stdc++.h> using namespace std; typedef long long LL; #define FOR(i,a,b) for(int i = (a) , _b = (b); i <= _b; ++i) #define MASK(x) ((LL)(1)<<(x)) #define BIT(mask , x) (((mask)>>x)&(1)) #define sz(x) (int)(x).size() template<class X,class Y> bool maximize(X &x , Y y){ if (x < y) return x = y , true; else return false; } template<class X,class Y> bool minimize(X &x , Y y){ if (x > y) return x = y , true; else return false; } template<class T> void compress(vector<T>&data){ sort(data.begin() , data.end()); data.resize(unique(data.begin() , data.end()) - data.begin()); } template<class X,class Y> int Find(vector<X>&data,Y y){ return upper_bound(data.begin() , data.end() , y) - data.begin(); } const int MAXLOG = (int) 64; const int N = (int)5e5; LL diff[N + 2] = {}; int n; int a[N + 2] , b[N + 2]; int main(){ ios::sync_with_stdio(false); cin.tie(0) ; cout.tie(0) ; #define name "main" if (fopen(name".inp","r")){ freopen(name".inp","r",stdin); freopen(name".out","w",stdout); } cin >> n; for(int i = 1; i <= n; ++i) { cin >> a[i] >> b[i]; diff[i] = a[i] - b[i]; } for(int turn = 1; turn <= MAXLOG; ++turn){ for(int i = 1; i <= n; ++i) { if (diff[i] > 0){ int nxt = (i % n) + 1; LL xx = (diff[i] + 1) / 2; diff[i] -= xx * 2; diff[nxt] += xx; } } } bool ok = false; for(int i = 1; i <= n; ++i) ok |= (b[i] > 0); if (!ok){ cout << "No"; return false; } for(int i = 1; i <= n; ++i) if (diff[i] != 0){ cout << "No"; return 0; } cout << "Yes"; }

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

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