제출 #963455

#제출 시각아이디문제언어결과실행 시간메모리
963455noobcodur송금 (JOI19_remittance)C++14
100 / 100
166 ms36496 KiB
#include<bits/stdc++.h> using namespace std; using ld = long double; #define int long long #define pii pair<int,int> #define forn(i,j) for(int i = 0; i < j; ++i) #define forrange(i,j,k) for(int i = j; i < k; ++i) #define vi vector<int> #define vpii vector<pii> #define f first #define s second #define pb push_back #define all(x) x.begin(),x.end() const int MOD = 1e9+7; const int INF = 1e17+1; const int maxN = 1e6+1; void setIO(string name){ ios_base::sync_with_stdio(0); cin.tie(0); if(!name.empty()){ freopen((name + ".in").c_str(),"r",stdin); freopen((name + ".out").c_str(),"w",stdout); } } int a[maxN],b[maxN]; signed main(){ setIO(""); int n; cin >> n; forn(i,n) cin >> a[i] >> b[i]; while(maxN){ int freq = 0; forn(i,n){ if(a[i] <= b[i]) continue; int x = (a[i]-b[i]+1)/2; if(x && a[i] - 2*x >= 0){ a[i] -= 2*x; a[(i+1) % n] += x; freq++; } } if(!freq) break; } forn(i,n){ if(a[i] != b[i]){ cout << "No" << endl; return 0; } } cout << "Yes" << endl; }

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

remittance.cpp: In function 'void setIO(std::string)':
remittance.cpp:24:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   freopen((name + ".in").c_str(),"r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
remittance.cpp:25:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   freopen((name + ".out").c_str(),"w",stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...