Submission #152316

# Submission time Handle Problem Language Result Execution time Memory
152316 2019-09-07T12:18:04 Z ivandasfs Remittance (JOI19_remittance) C++14
0 / 100
2 ms 504 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<20*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);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 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 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 256 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 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 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 256 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 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 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 256 KB Output isn't correct
9 Halted 0 ms 0 KB -