답안 #152317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152317 2019-09-07T12:18:46 Z ivandasfs 송금 (JOI19_remittance) C++14
0 / 100
2 ms 376 KB
#include <iostream>
#include <cstdio>

using namespace std;

pair<int, int> p[1000005];

int main() {
	int n;
	scanf("%d", &n);
	for (int i=0 ; i<n ; i++) {
		scanf("%d %d", &p[i].first, &p[i].second);
	}
	for (int j=0 ; j<50*n ; j++) {
		int i = j%n;
		int k = (i+1)%n;
		if (p[i].first>p[i].second) {
			int br = (p[i].first - p[i].second) / 2;
			p[i].first -= br*2;
			p[k].first += br;
		}
	}
	for (int i=0 ; i<n ; i++) {
		if (p[i].first != p[i].second) {
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
remittance.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &p[i].first, &p[i].second);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 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 256 KB Output is correct
8 Incorrect 2 ms 248 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 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 256 KB Output is correct
8 Incorrect 2 ms 248 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 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 256 KB Output is correct
8 Incorrect 2 ms 248 KB Output isn't correct
9 Halted 0 ms 0 KB -