답안 #200791

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
200791 2020-02-08T07:25:43 Z dennisstar 송금 (JOI19_remittance) C++17
0 / 100
7 ms 380 KB
#include <bits/stdc++.h>
using namespace std;

int N, A[1000010], B[1000010], D[1000010];

int main() {
	scanf("%d", &N);
	for (int i=0; i<N; i++) scanf("%d %d", &A[i], &B[i]), D[i]=A[i]-B[i];
	for (int p=0; p<32; p++) for (int i=0; i<N; i++) if (D[i]>0) {
		int x=min(D[i]/2, A[i]/2);
		A[i]-=x*2, D[i]-=x*2;
		A[(i+1)%N]+=x, D[(i+1)%N]+=x;
	}
	for (int i=0; i<N; i++) if (A[i]!=B[i]) { puts("No"); return 0; }
	puts("Yes");
	return 0;
}

Compilation message

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