This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define PB push_back
using namespace std;
typedef long double ld;
const int N = 400100;
const ld E = 1e-10;
int a, b, c, d, x, y;
void prit(){
cout << x << " " << y << '\n';
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> a >> b >> c >> d;
cout << "0 0\n";
if (a == 0 && b == 0){ // 0
for (int it = 0; it < c / 2; it++){
x++; y++;
prit();
}
x--; y++;
prit();
for (int it = 1; it < c / 2; it++){
x--; y--;
prit();
}
for (int it = 1; it < d / 2; it++){
x--; y++;
prit();
}
x--; y--;
prit();
for (int it = 0; it < d / 2; it++){
x++; y--;
if (x != 0 || y != 0)
prit();
}
return 0;
}
if (a % 2 == 0 && b % 2 == 0 && a > 0 && b > 0 && c % 2 == 0 && d % 2 == 0){
for (int it = 0; it < a / 2; it++){
x++;
prit();
}
for (int it = 0; it < b / 2; it++){
y++;
prit();
}
for (int it = 0; it < c / 2; it++){
x++; y++;
prit();
}
for (int it = 0; it < d / 2; it++){
x--; y++;
prit();
}
x--;
prit();
for (int it = 0; it < d / 2; it++){
x++; y--;
prit();
}
for (int it = 0; it < c / 2; it++){
x--; y--;
prit();
}
for (int it = 1; it < b / 2; it++){
y--;
prit();
}
for (int it = 1; it < a / 2; it++){
x--;
prit();
}
return 0;
}
if (c % 2 == 0 && c > 0 && a % 2 == 0 && a > 0 && b % 2 == 0 && d % 2 == 0){
for (int i = 0; i < a / 2; i++){
x++;
prit();
}
x++; y++;
prit();
for (int i = 0; i < b / 2; i++){
y++;
prit();
}
for (int i = 1; i < c / 2; i++){
x++; y++;
prit();
}
for (int i = 0; i < d / 2; i++){
x--; y++;
prit();
}
x--;
prit();
for (int i = 0; i < d / 2; i++){
x++; y--;
prit();
}
for (int i = 1; i < c / 2; i++){
x--; y--;
prit();
}
for (int i = 0; i < b / 2; i++){
y--;
prit();
}
for (int i = 1; i < a / 2; i++){
x--;
prit();
}
return 0;
}
if (d % 2 == 0 && d > 0 && a % 2 == 0 && a > 0 && b % 2 == 0 && c % 2 == 0){
for (int i = 0; i < a / 2; i++){
x++;
prit();
}
x--; y++;
prit();
for (int i = 0; i < b / 2; i++){
y++;
prit();
}
for (int i = 0; i < c / 2; i++){
x++; y++;
prit();
}
for (int i = 1; i < d / 2; i++){
x--; y++;
prit();
}
x--;
prit();
for (int i = 1; i < d / 2; i++){
x++; y--;
prit();
}
for (int i = 0; i < c / 2; i++){
x--; y--;
prit();
}
for (int i = 0; i < b / 2; i++){
y--;
prit();
}
for (int i = 1; i < a / 2; i++){
x--;
prit();
}
return 0;
}
if (a % 2 == 0 && a > 0 && c % 2 == 1 && d % 2 == 1){
for (int i = 1; i < a / 2; i++){
x++;
prit();
}
x++; y++;
prit();
for (int it = 0; it < b / 2; it++){
y++;
prit();
}
for (int it = 0; it < c / 2; it++){
x++; y++;
prit();
}
for (int it = 0; it < d / 2; it++){
x--; y++;
prit();
}
x--;
prit();
for (int it = 0; it < d / 2; it++){
x++; y--;
prit();
}
for (int it = 0; it < c / 2; it++){
x--; y--;
prit();
}
for (int it = 0; it < b / 2; it++){
y--;
prit();
}
for (int i = 0; i < a / 2; i++){
x--;
prit();
}
return 0;
}
if (b % 2 == 0 && b > 0 && c % 2 == 1 && d % 2 == 1){
for (int i = 1; i < b / 2; i++){
y++;
prit();
}
x--; y++;
prit();
for (int it = 0; it < a / 2; it++){
x--;
prit();
}
for (int it = 0; it < c / 2; it++){
x--; y--;
prit();
}
for (int it = 0; it < d / 2; it++){
x--; y++;
prit();
}
y--;
prit();
for (int it = 0; it < d / 2; it++){
x++; y--;
prit();
}
for (int it = 0; it < c / 2; it++){
x++; y++;
prit();
}
for (int it = 0; it < a / 2; it++){
x++;
prit();
}
for (int i = 0; i < b / 2; i++){
y--;
prit();
}
return 0;
}
if (b % 2 == 0 && b > 0 && c % 2 == 0 && c > 0){
for (int i = 0; i < b / 2; i++){
y++;
prit();
}
x--; y--;
prit();
for (int it = 0; it < a / 2; it++){
x--;
prit();
}
for (int it = 1; it < c / 2; it++){
x--; y--;
prit();
}
for (int it = 0; it < d / 2; it++){
x--; y++;
prit();
}
y--;
prit();
for (int it = 0; it < d / 2; it++){
x++; y--;
prit();
}
for (int it = 1; it < c / 2; it++){
x++; y++;
prit();
}
for (int it = 0; it < a / 2; it++){
x++;
prit();
}
for (int i = 1; i < b / 2; i++){
y--;
prit();
}
return 0;
}
if (b % 2 == 0 && b > 0 && d % 2 == 0 && d > 0){
for (int i = 0; i < b / 2; i++){
y++;
prit();
}
x--; y++;
prit();
for (int it = 0; it < a / 2; it++){
x--;
prit();
}
for (int it = 0; it < c / 2; it++){
x--; y--;
prit();
}
for (int it = 1; it < d / 2; it++){
x--; y++;
prit();
}
y--;
prit();
for (int it = 1; it < d / 2; it++){
x++; y--;
prit();
}
for (int it = 0; it < c / 2; it++){
x++; y++;
prit();
}
for (int it = 0; it < a / 2; it++){
x++;
prit();
}
for (int i = 1; i < b / 2; i++){
y--;
prit();
}
return 0;
}
if (a % 2 == 1 && b % 2 == 1 && c % 2 == 1){
for (int i = 0; i < a / 2; i++){
x++;
prit();
}
x++; y++;
prit();
for (int i = 0; i < b / 2; i++){
y++;
prit();
}
for (int i = 0; i < c / 2; i++){
x++; y++;
prit();
}
for (int i = 0; i < d / 2; i++){
x--; y++;
prit();
}
x--;
prit();
for (int i = 0; i < d / 2; i++){
x++; y--;
prit();
}
for (int i = 0; i < c / 2; i++){
x--; y--;
prit();
}
for (int i = 0; i < b / 2; i++){
y--;
prit();
}
for (int i = 0; i < a / 2; i++){
x--;
prit();
}
return 0;
}
if (b % 2 == 0 && b > 0 && d % 2 == 0 && d > 0){
for (int i = 0; i < b / 2; i++){
y++;
prit();
}
x--; y++;
prit();
for (int it = 0; it < a / 2; it++){
x--;
prit();
}
for (int it = 0; it < c / 2; it++){
x--; y--;
prit();
}
for (int it = 1; it < d / 2; it++){
x--; y++;
prit();
}
y--;
prit();
for (int it = 1; it < d / 2; it++){
x++; y--;
prit();
}
for (int it = 0; it < c / 2; it++){
x++; y++;
prit();
}
for (int it = 0; it < a / 2; it++){
x++;
prit();
}
for (int i = 1; i < b / 2; i++){
y--;
prit();
}
return 0;
}
if (a % 2 == 1 && b % 2 == 1 && d % 2 == 1){
for (int i = 0; i < a / 2; i++){
x++;
prit();
}
y++;
prit();
for (int i = 0; i < b / 2; i++){
y++;
prit();
}
for (int i = 0; i < c / 2; i++){
x++; y++;
prit();
}
for (int i = 0; i < d / 2; i++){
x--; y++;
prit();
}
x--;
prit();
for (int i = 0; i < d / 2; i++){
x++; y--;
prit();
}
for (int i = 0; i < c / 2; i++){
x--; y--;
prit();
}
for (int i = 0; i < b / 2; i++){
y--;
prit();
}
for (int i = 0; i < a / 2; i++){
x--;
prit();
}
return 0;
}
return -1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |