Submission #220716

#TimeUsernameProblemLanguageResultExecution timeMemory
220716DodgeBallManRemittance (JOI19_remittance)C++14
55 / 100
40 ms4088 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; long long a[N], b[N]; int n; int main() { scanf("%d",&n); for( int i = 0 ; i < n ; i++ ) scanf("%lld %lld",&a[i],&b[i]); while( 1 ) { bool chk = false; for( int i = 0 ; i < n ; i++ ) { int nxt = ( i + 1 ) % n; int d = a[i] - b[i]; if( d >= 2 ) { a[i] -= 2*( d/2 ); a[nxt] += d/2; chk = true; } else if( d == 1 && a[i] > 1 ) { a[i] -= 2; a[nxt] += 1; chk = true; } } if( !chk ) break; } for( int i = 0 ; i <= n ; i++ ) if( a[i] != b[i] ) return !printf("No\n"); printf("Yes\n"); return 0; }

Compilation message (stderr)

remittance.cpp: In function 'int main()':
remittance.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
remittance.cpp:11:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for( int i = 0 ; i < n ; i++ ) scanf("%lld %lld",&a[i],&b[i]);
                                    ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...