Submission #13874

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

const int EE = 2222;

void ainta() {
    for (int i=0; i<66; i++) {
        paint(i,0);
    }
    for (int i=0; i<66; i++) {
        paint(0,i);
    }
    for (int i=0; i<7 + 34 - 66 + 7 + 34; i++) {
        paint(0,0);
    }
}

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