답안 #321265

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
321265 2020-11-11T19:19:19 Z CaroLinda 송금 (JOI19_remittance) C++14
0 / 100
1 ms 364 KB
#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 < 32 ; 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") ;

}

Compilation message

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] ) ;
      |                               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Incorrect 1 ms 364 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Incorrect 1 ms 364 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Incorrect 1 ms 364 KB Output isn't correct
9 Halted 0 ms 0 KB -