Submission #144587

#TimeUsernameProblemLanguageResultExecution timeMemory
144587SamAndPick (COI18_pick)C++17
10 / 100
3 ms376 KiB
#include <bits/stdc++.h>
using namespace std;
const int xx[8] = {1, 0, 1, 1, -1, 0, -1, -1};
const int yy[8] = {0, 1, 1, -1, 0, -1, -1, 1};

int a, b, c, d;

void solv1()
{
    int x = 0, y = 0;
    for (int i = 0; i < a / 2; ++i)
    {
        cout << x << ' ' << y << endl;
        x += xx[0];
        y += yy[0];
    }
    for (int i = 0; i < b / 2; ++i)
    {
        cout << x << ' ' << y << endl;
        x += xx[1];
        y += yy[1];
    }
    for (int i = 0; i < a / 2; ++i)
    {
        cout << x << ' ' << y << endl;
        x += xx[4];
        y += yy[4];
    }
    for (int i = 0; i < b / 2; ++i)
    {
        cout << x << ' ' << y << endl;
        x += xx[5];
        y += yy[5];
    }
}

void solv2()
{
    int x = 0, y = 0;
    for (int i = 0; i < c / 2; ++i)
    {
        cout << x << ' ' << y << endl;
        x += xx[2];
        y += yy[2];
    }
    for (int i = 0; i < d / 2; ++i)
    {
        cout << x << ' ' << y << endl;
        x += xx[3];
        y += yy[3];
    }
    for (int i = 0; i < c / 2; ++i)
    {
        cout << x << ' ' << y << endl;
        x += xx[6];
        y += yy[6];
    }
    for (int i = 0; i < d / 2; ++i)
    {
        cout << x << ' ' << y << endl;
        x += xx[7];
        y += yy[7];
    }
}

int main()
{
    cin >> a >> b >> c >> d;
    if (c == 0 && d == 0)
    {
        solv1();
    }
    else if (a == 0 && b == 0)
    {
        solv2();
    }
    return 0;
}
#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...