Submission #45011

# Submission time Handle Problem Language Result Execution time Memory
45011 2018-04-10T14:26:21 Z Xellos Pick (COI18_pick) C++14
100 / 100
2 ms 752 KB
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define sgn(x) (((x) < 0)?-1:1)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N[4];
	for(int i = 0; i < 4; i++) cin >> N[i];
	vector<int> E;
	int dx[] = {1, 0, 1, 1};
	int dy[] = {0, 1, 1, -1};

	if(N[0]+N[1]) {
		if(N[0]&1) {
			for(int i = 0; i < (N[2]+1)/2; i++) E.push_back(3);
			if(N[2]&1) {
				for(int i = 0; i < N[1]/2; i++) E.push_back(2);
				E.push_back(-1);
				for(int i = 0; i < N[1]/2; i++) E.push_back(-2);
			}
			else {
				for(int i = 0; i < N[0]/2; i++) E.push_back(1);
				E.push_back(2);
				for(int i = 0; i < N[0]/2; i++) E.push_back(-1);
			}
			for(int i = 0; i < N[2]/2; i++) E.push_back(-3);
			for(int i = 0; i < N[3]/2; i++) E.push_back(-4);
			if(N[3]&1) {
				for(int i = 0; i < N[1]/2; i++) E.push_back(2);
				E.push_back(-1);
				for(int i = 0; i < N[1]/2; i++) E.push_back(-2);
			}
			else {
				for(int i = 0; i < N[0]/2; i++) E.push_back(-1);
				E.push_back(-2);
				for(int i = 0; i < N[0]/2; i++) E.push_back(1);
			}
			for(int i = 0; i < (N[3]+1)/2; i++) E.push_back(4);
		}
		else if(N[0]) {
			for(int i = 0; i < (N[2]+1)/2-1; i++) E.push_back(3);
			if(N[2]) {
				for(int i = 0; i < N[0]/2-1; i++) E.push_back(1);
				E.push_back(3);
				for(int i = 0; i < N[0]/2-1; i++) E.push_back(-1);
			}
			for(int i = 0; i < N[1]/2-1; i++) E.push_back(2);
			if(N[2] == 0 && N[1] >= 2) {
				for(int i = 0; i < N[0]/2-1; i++) E.push_back(1);
				E.push_back(2);
				for(int i = 0; i < N[0]/2-1; i++) E.push_back(-1);
			}
			else if(N[1] >= 2) E.push_back(2);
			E.push_back(-1);
			for(int i = 0; i < N[1]/2; i++) E.push_back(-2);
			for(int i = 0; i < N[2]-(N[2]+1)/2; i++) E.push_back(-3);
			if(N[2]&1) {
				for(int i = 0; i < N[3]/2; i++) E.push_back(-4);
				E.push_back(-1);
				for(int i = 0; i < (N[3]+1)/2; i++) E.push_back(4);
			}
			else {
				for(int i = 0; i < N[3]/2; i++) E.push_back(4);
				E.push_back(1);
				for(int i = 0; i < N[3]/2-1; i++) E.push_back(-4);
				if(N[2]+N[1] == 0) {
					for(int i = 0; i < N[0]/2-1; i++) E.push_back(1);
					E.push_back(-4);
					for(int i = 0; i < N[0]/2-1; i++) E.push_back(-1);
				}
				else if(N[3] >= 2) E.push_back(-4);
			}
		}
		else if(N[1]) {
			for(int i = 0; i < (N[2]+1)/2-1; i++) E.push_back(3);
			if(N[2]) {
				for(int i = 0; i < N[1]/2-1; i++) E.push_back(2);
				E.push_back(3);
				for(int i = 0; i < N[1]/2-1; i++) E.push_back(-2);
			}
			E.push_back(-2);
			for(int i = 0; i < N[2]-(N[2]+1)/2; i++) E.push_back(-3);
			if(N[2]&1) {
				for(int i = 0; i < N[3]/2; i++) E.push_back(4);
				E.push_back(-2);
				for(int i = 0; i < (N[3]+1)/2; i++) E.push_back(-4);
			}
			else {
				for(int i = 0; i < N[3]/2; i++) E.push_back(-4);
				E.push_back(2);
				if(N[2] == 0) for(int i = 0; i < N[1]/2-1; i++) E.push_back(2);
				if(N[3]) E.push_back(4);
				if(N[2] == 0) for(int i = 0; i < N[1]/2-1; i++) E.push_back(-2);
				for(int i = 0; i < N[3]/2-1; i++) E.push_back(4);
			}
		}
	}
	else {
		N[2] /= 2, N[3] /= 2;
		for(int i = 0; i < N[2]; i++) E.push_back(3);
		E.push_back(-4);
		for(int i = 0; i < N[2]-1; i++) E.push_back(-3);
		for(int i = 0; i < N[3]-1; i++) E.push_back(-4);
		E.push_back(-3);
		for(int i = 0; i < N[3]; i++) E.push_back(4);
	}

	int x = 0, y = 0;
	for(int i = 0; i < (int)E.size(); i++) {
		cout << x << " " << y << "\n";
		x += sgn(E[i]) * dx[abs(E[i])-1];
		y += sgn(E[i]) * dy[abs(E[i])-1];
	}
	assert(x == 0 && y == 0);
	return 0;}

// look at my code
// my code is amazing
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 492 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 2 ms 732 KB Output is correct
6 Correct 2 ms 732 KB Output is correct
7 Correct 2 ms 732 KB Output is correct
8 Correct 2 ms 732 KB Output is correct
9 Correct 2 ms 732 KB Output is correct
10 Correct 2 ms 732 KB Output is correct
11 Correct 2 ms 732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 2 ms 732 KB Output is correct
6 Correct 2 ms 732 KB Output is correct
7 Correct 2 ms 732 KB Output is correct
8 Correct 2 ms 732 KB Output is correct
9 Correct 2 ms 732 KB Output is correct
10 Correct 2 ms 732 KB Output is correct
11 Correct 2 ms 732 KB Output is correct
12 Correct 2 ms 732 KB Output is correct
13 Correct 2 ms 732 KB Output is correct
14 Correct 2 ms 732 KB Output is correct
15 Correct 2 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 2 ms 732 KB Output is correct
6 Correct 2 ms 732 KB Output is correct
7 Correct 2 ms 732 KB Output is correct
8 Correct 2 ms 732 KB Output is correct
9 Correct 2 ms 732 KB Output is correct
10 Correct 2 ms 732 KB Output is correct
11 Correct 2 ms 732 KB Output is correct
12 Correct 2 ms 732 KB Output is correct
13 Correct 2 ms 732 KB Output is correct
14 Correct 2 ms 732 KB Output is correct
15 Correct 2 ms 748 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 2 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 2 ms 732 KB Output is correct
6 Correct 2 ms 732 KB Output is correct
7 Correct 2 ms 732 KB Output is correct
8 Correct 2 ms 732 KB Output is correct
9 Correct 2 ms 732 KB Output is correct
10 Correct 2 ms 732 KB Output is correct
11 Correct 2 ms 732 KB Output is correct
12 Correct 2 ms 732 KB Output is correct
13 Correct 2 ms 732 KB Output is correct
14 Correct 2 ms 732 KB Output is correct
15 Correct 2 ms 748 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 2 ms 748 KB Output is correct
19 Correct 2 ms 748 KB Output is correct
20 Correct 2 ms 748 KB Output is correct
21 Correct 2 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 2 ms 732 KB Output is correct
6 Correct 2 ms 732 KB Output is correct
7 Correct 2 ms 732 KB Output is correct
8 Correct 2 ms 732 KB Output is correct
9 Correct 2 ms 732 KB Output is correct
10 Correct 2 ms 732 KB Output is correct
11 Correct 2 ms 732 KB Output is correct
12 Correct 2 ms 732 KB Output is correct
13 Correct 2 ms 732 KB Output is correct
14 Correct 2 ms 732 KB Output is correct
15 Correct 2 ms 748 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 2 ms 748 KB Output is correct
19 Correct 2 ms 748 KB Output is correct
20 Correct 2 ms 748 KB Output is correct
21 Correct 2 ms 748 KB Output is correct
22 Correct 2 ms 748 KB Output is correct
23 Correct 2 ms 752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 2 ms 640 KB Output is correct
12 Correct 2 ms 732 KB Output is correct
13 Correct 2 ms 732 KB Output is correct
14 Correct 2 ms 732 KB Output is correct
15 Correct 2 ms 732 KB Output is correct
16 Correct 2 ms 732 KB Output is correct
17 Correct 2 ms 732 KB Output is correct
18 Correct 2 ms 732 KB Output is correct
19 Correct 2 ms 732 KB Output is correct
20 Correct 2 ms 732 KB Output is correct
21 Correct 2 ms 732 KB Output is correct
22 Correct 2 ms 732 KB Output is correct
23 Correct 2 ms 748 KB Output is correct
24 Correct 2 ms 748 KB Output is correct
25 Correct 2 ms 748 KB Output is correct
26 Correct 2 ms 748 KB Output is correct
27 Correct 2 ms 748 KB Output is correct
28 Correct 2 ms 748 KB Output is correct
29 Correct 2 ms 748 KB Output is correct
30 Correct 2 ms 748 KB Output is correct
31 Correct 2 ms 752 KB Output is correct
32 Correct 2 ms 752 KB Output is correct
33 Correct 2 ms 752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 2 ms 640 KB Output is correct
12 Correct 2 ms 732 KB Output is correct
13 Correct 2 ms 732 KB Output is correct
14 Correct 2 ms 732 KB Output is correct
15 Correct 2 ms 732 KB Output is correct
16 Correct 2 ms 732 KB Output is correct
17 Correct 2 ms 732 KB Output is correct
18 Correct 2 ms 732 KB Output is correct
19 Correct 2 ms 732 KB Output is correct
20 Correct 2 ms 732 KB Output is correct
21 Correct 2 ms 732 KB Output is correct
22 Correct 2 ms 732 KB Output is correct
23 Correct 2 ms 748 KB Output is correct
24 Correct 2 ms 748 KB Output is correct
25 Correct 2 ms 748 KB Output is correct
26 Correct 2 ms 748 KB Output is correct
27 Correct 2 ms 748 KB Output is correct
28 Correct 2 ms 748 KB Output is correct
29 Correct 2 ms 748 KB Output is correct
30 Correct 2 ms 748 KB Output is correct
31 Correct 2 ms 752 KB Output is correct
32 Correct 2 ms 752 KB Output is correct
33 Correct 2 ms 752 KB Output is correct
34 Correct 2 ms 752 KB Output is correct
35 Correct 2 ms 752 KB Output is correct
36 Correct 2 ms 752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 2 ms 640 KB Output is correct
12 Correct 2 ms 732 KB Output is correct
13 Correct 2 ms 732 KB Output is correct
14 Correct 2 ms 732 KB Output is correct
15 Correct 2 ms 732 KB Output is correct
16 Correct 2 ms 732 KB Output is correct
17 Correct 2 ms 732 KB Output is correct
18 Correct 2 ms 732 KB Output is correct
19 Correct 2 ms 732 KB Output is correct
20 Correct 2 ms 732 KB Output is correct
21 Correct 2 ms 732 KB Output is correct
22 Correct 2 ms 732 KB Output is correct
23 Correct 2 ms 748 KB Output is correct
24 Correct 2 ms 748 KB Output is correct
25 Correct 2 ms 748 KB Output is correct
26 Correct 2 ms 748 KB Output is correct
27 Correct 2 ms 748 KB Output is correct
28 Correct 2 ms 748 KB Output is correct
29 Correct 2 ms 748 KB Output is correct
30 Correct 2 ms 748 KB Output is correct
31 Correct 2 ms 752 KB Output is correct
32 Correct 2 ms 752 KB Output is correct
33 Correct 2 ms 752 KB Output is correct
34 Correct 2 ms 752 KB Output is correct
35 Correct 2 ms 752 KB Output is correct
36 Correct 2 ms 752 KB Output is correct
37 Correct 2 ms 752 KB Output is correct
38 Correct 2 ms 752 KB Output is correct
39 Correct 2 ms 752 KB Output is correct
40 Correct 2 ms 752 KB Output is correct
41 Correct 2 ms 752 KB Output is correct
42 Correct 2 ms 752 KB Output is correct
43 Correct 2 ms 752 KB Output is correct