Submission #71548

# Submission time Handle Problem Language Result Execution time Memory
71548 2018-08-25T05:44:28 Z 강태규(#2217) 행성 탐사 (GA8_planet) C++11
97.4 / 100
1057 ms 1264 KB
#include "planet.h"
#include <algorithm>
#include <ctime>

using namespace std;

const int t = 101;
const int mx = 2222;
void ainta() {
    for (int i = 0; i < t; ++i) paint(i, i);
}

int mr = -1, mc;
int countR(int r) {
    return count_row((mr + r) % mx);
}

int countC(int c) {
    return count_col((mc + c) % mx);
}

void answer(int r, int c) {
    report((r + mr) % mx, (c + mc) % mx);
}

void sangsoo() {
    if (mr == -1) srand(time(0));
    mr = rand() % mx; mc = rand() % mx;
    
    int r = -1, c = -1;
    int sr = 0, er = mx - 1, sc = 0, ec = mx - 1;
    int rmd = 0, cmd = 0;
    for (int it = 1; r == -1 || c == -1; ++it) {
        int i = min(it, t);
        if (r == -1) {
            if (er - sr + 1 <= i) rmd = 1;
            if (rmd) {
                int m = (sr + er) >> 1;
                if (countR((m + mx) % mx)) er = m;
                else sr = m + 1;
                if (sr == er) r = (sr + mx) % mx;
                continue;
            }
            if (countR(er)) {
                if (i == 1) r = er;
                sr = max(0, er - i + 1);
                rmd = 1;
            }
            else {
                er -= i;
            }
        }
        else {
            if (ec - sc + 1 <= i) cmd = 1;
            if (cmd) {
                int m = (sc + ec) >> 1;
                if (countC((m + mx) % mx)) ec = m;
                else sc = m + 1;
                if (sc == ec) c = (sc + mx) % mx;
                continue;
            }
            if (countC(ec)) {
                sc = max(0, ec - i + 1);
                cmd = 1;
            }
            else {
                ec -= i;
            }
        }
    }
    answer(r, c);
}
# Verdict Execution time Memory Grader output
1 Partially correct 87 ms 1016 KB Output is partially correct: max_calls = 105
2 Partially correct 80 ms 1016 KB Output is partially correct: max_calls = 104
3 Partially correct 88 ms 1160 KB Output is partially correct: max_calls = 105
4 Partially correct 86 ms 1184 KB Output is partially correct: max_calls = 105
5 Partially correct 88 ms 1184 KB Output is partially correct: max_calls = 104
6 Partially correct 78 ms 1184 KB Output is partially correct: max_calls = 105
7 Partially correct 94 ms 1184 KB Output is partially correct: max_calls = 105
8 Partially correct 90 ms 1264 KB Output is partially correct: max_calls = 105
9 Partially correct 96 ms 1264 KB Output is partially correct: max_calls = 105
10 Partially correct 98 ms 1264 KB Output is partially correct: max_calls = 105
11 Partially correct 91 ms 1264 KB Output is partially correct: max_calls = 105
12 Partially correct 87 ms 1264 KB Output is partially correct: max_calls = 105
13 Partially correct 87 ms 1264 KB Output is partially correct: max_calls = 105
14 Partially correct 94 ms 1264 KB Output is partially correct: max_calls = 105
15 Partially correct 92 ms 1264 KB Output is partially correct: max_calls = 105
16 Partially correct 92 ms 1264 KB Output is partially correct: max_calls = 105
17 Partially correct 97 ms 1264 KB Output is partially correct: max_calls = 105
18 Partially correct 89 ms 1264 KB Output is partially correct: max_calls = 105
19 Partially correct 95 ms 1264 KB Output is partially correct: max_calls = 105
20 Partially correct 171 ms 1264 KB Output is partially correct: max_calls = 105
# Verdict Execution time Memory Grader output
1 Partially correct 817 ms 1264 KB Output is partially correct: max_calls = 105
2 Partially correct 807 ms 1264 KB Output is partially correct: max_calls = 105
3 Partially correct 807 ms 1264 KB Output is partially correct: max_calls = 105
4 Partially correct 840 ms 1264 KB Output is partially correct: max_calls = 105
5 Partially correct 840 ms 1264 KB Output is partially correct: max_calls = 105
6 Partially correct 810 ms 1264 KB Output is partially correct: max_calls = 105
7 Partially correct 860 ms 1264 KB Output is partially correct: max_calls = 105
8 Partially correct 852 ms 1264 KB Output is partially correct: max_calls = 105
9 Partially correct 948 ms 1264 KB Output is partially correct: max_calls = 105
10 Partially correct 867 ms 1264 KB Output is partially correct: max_calls = 105
11 Partially correct 288 ms 1264 KB Output is partially correct: max_calls = 105
12 Partially correct 898 ms 1264 KB Output is partially correct: max_calls = 105
13 Partially correct 934 ms 1264 KB Output is partially correct: max_calls = 105
14 Partially correct 894 ms 1264 KB Output is partially correct: max_calls = 105
15 Partially correct 883 ms 1264 KB Output is partially correct: max_calls = 105
16 Partially correct 940 ms 1264 KB Output is partially correct: max_calls = 105
17 Partially correct 864 ms 1264 KB Output is partially correct: max_calls = 105
18 Partially correct 1057 ms 1264 KB Output is partially correct: max_calls = 105
19 Partially correct 978 ms 1264 KB Output is partially correct: max_calls = 105
20 Partially correct 941 ms 1264 KB Output is partially correct: max_calls = 105
21 Partially correct 899 ms 1264 KB Output is partially correct: max_calls = 105
22 Partially correct 952 ms 1264 KB Output is partially correct: max_calls = 105
23 Partially correct 841 ms 1264 KB Output is partially correct: max_calls = 105