제출 #7541

#제출 시각아이디문제언어결과실행 시간메모리
7541kipa00행성 탐사 (GA8_planet)C++98
51.60 / 100
2488 ms1756 KiB
#include "planet.h"
 
//야! 내가 멍청이다!
 
int cr(int a) {
  return count_row((a + 4444) % 2222);
}
 
int cc(int a) {
  return count_col((a + 4444) % 2222);
}
 
//열심히 색칠하시는 분
void ainta() {
  int i;
  paint(0, 0);
  for (i=11; i<=1112; i+=11) {
    paint(i, 0);
    paint(0, i);
  }
}
 
//열심히 종횡조사하시는 분
void sangsoo() {
  int i, x = -1, y = -1, ok = 0;
  for (i=0; ok < 3; i+=7) {
    if (x >= 0) {
      if (ok & 2) cr(x);
      else {
        int temp = cr(x);
        if (temp <= 1) {
          x += 1;
        } else {
          ok |= 2;
        }
      }
    } else {
      int r = cr(-i);
      if (r > 1) {
        x = -i + 4444;
        ok |= 2;
      } else if (r == 1) {
        x = (-i * 18 / 7 - 2) + 4444;
      }
    }
    if (y >= 0) {
      if (ok & 1) cc(y);
      else {
        int temp = cc(y);
        if (temp <= 1) {
          y += 1;
        } else {
          ok |= 1;
        }
      }
    } else {
      int c = cc(-i);
      if (c > 1) {
        y = -i + 4444;
        ok |= 1;
      } else if (c == 1) {
        y = (-i * 18 / 7 - 2) + 4444;
      }
    }
  }
  report(x % 2222, y % 2222);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...