제출 #45011

#제출 시각아이디문제언어결과실행 시간메모리
45011XellosPick (COI18_pick)C++14
100 / 100
2 ms752 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...