Submission #13872

#TimeUsernameProblemLanguageResultExecution timeMemory
13872gs14004행성 탐사 (GA8_planet)C++14
74.10 / 100
1045 ms1752 KiB
#include "planet.h"

const int EE = 2222;

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

void sangsoo() {
    for(int i=0; i<34; i++){
        count_row(42); // ignore step 1.
    }
    int posx = 0;
    for (int i=0; i<66; i++) {
        if(count_row(i * 34 % EE)) posx = 34 * i % EE; // step 2.
    }
    int s = 0, e = 33;
    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<66; i++) {
        if(count_col(34 * i % EE)) posy = 34 * i % EE; // step 2.
    }
    s = 0, e = 33;
    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...