답안 #185375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
185375 2020-01-11T11:49:07 Z 설한동(C15-#564) 송금 (JOI19_remittance) C++17
0 / 100
8 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
int n; 
long long A[1111111], B[1111222]; 
int main(){
	long long extra, j=0;  
	scanf("%d", &n); 
	for(int i=1;i<=n;i++)scanf("%lld %lld", &A[i], &B[i]); 
	int yes=1;
	while(yes){
		yes=0; 
		for(int i=1;i<=n;i++){
			if(A[i]>B[i]){
				extra=A[i]-B[i]; 
				if(extra!=1)yes=1; 
				if(i==n)A[1]+=(extra/2); 
				else A[i+1]+=(extra/2); 
				A[i]=B[i]+extra%2; 
			}
		}
	}
	yes=1; 
	for(int i=1;i<=n;i++){
		if(A[i]!=B[i])yes=0; 
	}
	if(yes)printf("Yes"); 
	else printf("No"); 
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:6:19: warning: unused variable 'j' [-Wunused-variable]
  long long extra, j=0;  
                   ^
remittance.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n); 
  ~~~~~^~~~~~~~~~
remittance.cpp:8:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++)scanf("%lld %lld", &A[i], &B[i]); 
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 8 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 3 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 8 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 3 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 8 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 3 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -