Submission #13876

#TimeUsernameProblemLanguageResultExecution timeMemory
13876gs14004행성 탐사 (GA8_planet)C++14
79.20 / 100
945 ms1752 KiB
#include "planet.h"

const int EE = 2222;

void ainta() {
    for (int i=0; i<50; i++) {
        paint(i,0); // step 1.
    }
    for (int i=0; i<50; i++) {
        paint(0,i); // step 1.
    }
    for (int i=0; i<6 + 45 - 50; i++) {
        paint(0,0); // ignore step 2.
    }
    for (int i=0; i<6 + 45; i++) {
        paint(0,0); // ignore step 2.
    }
}

void sangsoo() {
    for(int i=0; i<50; i++){
        count_row(42); // ignore step 1.
    }
    int posx = 0;
    for (int i=0; i<45; i++) {
        if(count_row(i * 50 % EE)) posx = 50 * i % EE; // step 2.
    }
    int s = 0, e = 49;
    for(int i=0; i<6; i++){
        if(s == e){
            count_row(42);
            continue;
        }
        int m = (s+e+1) / 2;
        int new_pos = (posx + EE - m) % EE;
        if(count_row(new_pos)) s = m;
        else e = m-1;
    }
    posx = (posx + EE - s) % EE;
    int posy = 0;
    for (int i=0; i<45; i++) {
        if(count_col(50 * i % EE)) posy = 50 * i % EE; // step 2.
    }
    s = 0, e = 49;
    for(int i=0; i<6; i++){
        if(s == e){
            count_row(42);
            continue;
        }
        int m = (s+e+1) / 2;
        int new_pos = (posy + EE - m) % EE;
        if(count_col(new_pos)) s = m;
        else e = m-1;
    }
    posy = (posy + EE - s) % EE;
    report(posx,posy);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...