답안 #321272

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

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

	if(ok|everybodyOne) 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 384 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 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 512 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Incorrect 1 ms 364 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 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 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 512 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Incorrect 1 ms 364 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 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 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 512 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Incorrect 1 ms 364 KB Output isn't correct
21 Halted 0 ms 0 KB -