제출 #321266

#제출 시각아이디문제언어결과실행 시간메모리
321266CaroLinda송금 (JOI19_remittance)C++14
0 / 100
1 ms364 KiB
#include <bits/stdc++.h>

const int MAX = 1e6+10 ;

using namespace std ;

int n ;
long long cash[MAX] , desired[MAX] ;

int main()
{
	scanf("%d", &n ) ;

	for(int i= 0 ; i < n ; i++ ) scanf("%lld %lld", &cash[i] , &desired[i] ) ;

	for(int g = 0 ; g < 60 ; g++ )
	{
		for(int i= 0 , nxt = 1 ; i < n ; i++ , nxt++ )
		{
			if(nxt == n) nxt = 0 ;

			long long leftOver = cash[i] - desired[i] ;

			if(leftOver < 0 ) continue ;

			cash[i] -= (leftOver/2LL ) *2LL ;
			cash[nxt] += leftOver/2LL ;

		}
	}

	bool ok =true ;

	for(int i= 0 ; i < n ; i++ )
		if(cash[i] != desired[i] ) ok = false ;

	if(ok) printf("Yes\n") ;
	else printf("No\n") ;

}

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

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