답안 #185374

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
185374 2020-01-11T11:47:23 Z 설한동(C15-#564) 송금 (JOI19_remittance) C++17
0 / 100
1000 ms 552 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(i==n)A[1]+=(extra/2); 
				else A[i+1]+=(extra/2); 
				A[i]=B[i]+extra%2; 
				yes=1; 
			}
		}
		
		//printf("\n"); 
	}
	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 Execution timed out 1004 ms 552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1004 ms 552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1004 ms 552 KB Time limit exceeded
2 Halted 0 ms 0 KB -