답안 #243219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
243219 2020-06-30T14:57:21 Z VEGAnn Pick (COI18_pick) C++14
10 / 100
5 ms 512 KB
#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){
        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){
        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){
        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){
        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 = 1; 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 = 1; 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;
    }

    return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Runtime error 5 ms 512 KB Execution failed because the return code was nonzero
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Runtime error 5 ms 512 KB Execution failed because the return code was nonzero
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Runtime error 5 ms 512 KB Execution failed because the return code was nonzero
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Runtime error 5 ms 512 KB Execution failed because the return code was nonzero
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Runtime error 5 ms 512 KB Execution failed because the return code was nonzero
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Runtime error 5 ms 512 KB Execution failed because the return code was nonzero
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Runtime error 5 ms 512 KB Execution failed because the return code was nonzero
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Runtime error 5 ms 512 KB Execution failed because the return code was nonzero
15 Halted 0 ms 0 KB -