Submission #105582

# Submission time Handle Problem Language Result Execution time Memory
105582 2019-04-13T17:41:06 Z keko37 Pick (COI18_pick) C++14
100 / 100
4 ms 480 KB
#include<bits/stdc++.h>

using namespace std;

int a, b, c, d;
bool ab, cd;
string s;
vector < pair <int, int> > v;

void obradi () {
    int cx = 0, cy = 0;
    int len = s.size();
    for (int i=0; i<len; i++) {
        v.push_back(make_pair(cx, cy));
        if (s[i] == 'a') cx++; else if (s[i] == 'A') cx--;
        if (s[i] == 'b') cy++; else if (s[i] == 'B') cy--;
        if (s[i] == 'c') {cx++; cy++;} else if (s[i] == 'C') {cx--; cy--;}
        if (s[i] == 'd') {cx--; cy++;} else if (s[i] == 'D') {cx++; cy--;}
    }
}

void ispis () {
    if (ab) {
        for (int i=0; i<v.size(); i++) {
            swap(v[i].first, v[i].second);
        }
    }
    if (cd) {
        for (int i=0; i<v.size(); i++) {
            v[i].second = -v[i].second;
        }
    }
    for (int i=0; i<v.size(); i++) {
        cout << v[i].first << " " << v[i].second << endl;
    }
}

int main () {
    cin >> a >> b >> c >> d;
    if (c == 0 && d == 0) {
        for (int i=0; i<a/2; i++) s += 'a';
        s += 'b';
        for (int i=0; i<a/2-1; i++) s += 'A';
        for (int i=0; i<b/2-1; i++) s += 'b';
        s += 'A';
        for (int i=0; i<b/2; i++) s += 'B';
    } else if (a == 0 && b == 0) {
        for (int i=0; i<c/2; i++) s += 'c';
        s += 'd';
        for (int i=0; i<c/2-1; i++) s += 'C';
        for (int i=0; i<d/2-1; i++) s += 'd';
        s += 'C';
        for (int i=0; i<d/2; i++) s += 'D';
    } else {
        if (a == 0) {
            swap(a, b);
            ab = 1;
        }
        if (c == 0) {
            swap(c, d);
            cd = 1;
        }
        if (c != 0 && d != 0 && c%2 == 0) {
            swap(c, d);
            cd = 1;
        }
        if (a%2 == 0 && b%2 == 0 && c%2 == 0 && d%2 == 0) {
            for (int i=0; i<a/2; i++) s += 'a';
            s += 'c';
            for (int i=0; i<b/2; i++) s += 'b';
            for (int i=0; i<c/2-1; i++) s += 'c';
            for (int i=0; i<d/2; i++) s += 'd';
            s += 'A';
            for (int i=0; i<d/2; i++) s += 'D';
            for (int i=0; i<c/2-1; i++) s += 'C';
            for (int i=0; i<b/2; i++) s += 'B';
            for (int i=0; i<a/2-1; i++) s += 'A';
            s += 'C';
        } else if (a%2 == 0 && b%2 == 0 && c%2 == 1 && d%2 == 1) {
            for (int i=0; i<(a-2)/2; i++) s += 'a';
            s += 'c';
            for (int i=0; i<b/2; i++) s += 'b';
            for (int i=0; i<(c-1)/2; i++) s += 'c';
            for (int i=0; i<(d-1)/2; i++) s += 'd';
            s += 'A';
            for (int i=0; i<(d-1)/2; i++) s += 'D';
            for (int i=0; i<(c-1)/2; i++) s += 'C';
            for (int i=0; i<b/2; i++) s += 'B';
            for (int i=0; i<(a-2)/2; i++) s += 'A';
            s += 'A';
            s += 'D';
        } else if (a%2 == 1 && b%2 == 1 && c%2 == 1 && d%2 == 0) {
            for (int i=0; i<(a-1)/2; i++) s += 'a';
            s += 'c';
            for (int i=0; i<(b-1)/2; i++) s += 'b';
            for (int i=0; i<(c-1)/2; i++) s += 'c';
            for (int i=0; i<d/2; i++) s += 'd';
            s += 'A';
            for (int i=0; i<d/2; i++) s += 'D';
            for (int i=0; i<(c-1)/2; i++) s += 'C';
            for (int i=0; i<(b-1)/2; i++) s += 'B';
            for (int i=0; i<(a-1)/2; i++) s += 'A';
            s += 'B';
        }
    }
    obradi();
    ispis();
    return 0;
}

Compilation message

pick.cpp: In function 'void ispis()':
pick.cpp:24:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i=0; i<v.size(); i++) {
                       ~^~~~~~~~~
pick.cpp:29:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i=0; i<v.size(); i++) {
                       ~^~~~~~~~~
pick.cpp:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<v.size(); i++) {
                   ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 428 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 3 ms 428 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 3 ms 300 KB Output is correct
10 Correct 3 ms 432 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 3 ms 428 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 3 ms 300 KB Output is correct
10 Correct 3 ms 432 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 432 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 3 ms 428 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 3 ms 300 KB Output is correct
10 Correct 3 ms 432 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 432 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 480 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 3 ms 428 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 3 ms 300 KB Output is correct
10 Correct 3 ms 432 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 432 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 480 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 3 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 3 ms 428 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 3 ms 300 KB Output is correct
10 Correct 3 ms 432 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 432 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 480 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 3 ms 300 KB Output is correct
22 Correct 2 ms 372 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 428 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 3 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 3 ms 428 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 3 ms 300 KB Output is correct
18 Correct 3 ms 432 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 432 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 3 ms 480 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 3 ms 300 KB Output is correct
30 Correct 2 ms 372 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 3 ms 356 KB Output is correct
33 Correct 2 ms 428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 428 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 3 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 3 ms 428 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 3 ms 300 KB Output is correct
18 Correct 3 ms 432 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 432 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 3 ms 480 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 3 ms 300 KB Output is correct
30 Correct 2 ms 372 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 3 ms 356 KB Output is correct
33 Correct 2 ms 428 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 3 ms 428 KB Output is correct
36 Correct 3 ms 428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 428 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 3 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 3 ms 428 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 3 ms 300 KB Output is correct
18 Correct 3 ms 432 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 432 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 3 ms 480 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 3 ms 300 KB Output is correct
30 Correct 2 ms 372 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 3 ms 356 KB Output is correct
33 Correct 2 ms 428 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 3 ms 428 KB Output is correct
36 Correct 3 ms 428 KB Output is correct
37 Correct 3 ms 256 KB Output is correct
38 Correct 2 ms 336 KB Output is correct
39 Correct 3 ms 256 KB Output is correct
40 Correct 3 ms 256 KB Output is correct
41 Correct 3 ms 256 KB Output is correct
42 Correct 3 ms 384 KB Output is correct
43 Correct 3 ms 384 KB Output is correct