Submission #220720

#TimeUsernameProblemLanguageResultExecution timeMemory
220720DodgeBallManRemittance (JOI19_remittance)C++14
55 / 100
41 ms1912 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]); for( int j = 1 ; j <= 30 ; j++ ) { for( int i = 0 ; i < n ; i++ ) { int nxt = ( i + 1 ) % n; if( a[i] - b[i] >= 2 ) { int d = ( a[i] - b[i] ) / 2; a[i] -= 2*d; a[nxt] += d; } else if( a[i] - b[i] == 1 && a[i] > 1 ) { a[i] -= 2; a[nxt] += 1; } } } 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...