제출 #72343

#제출 시각아이디문제언어결과실행 시간메모리
72343인프라웨어 상한가 가주세요. 물렸어요 (#118)마법 다우징 (FXCUP3_magic)C++17
0 / 100
2 ms256 KiB
#include "dowsing.h" #include <vector> using namespace std; void FindTreasure(int N) { vector<vector<int>> board = vector<vector<int>>(N + 1, vector<int>(N + 1, 0)); bool calSol = false; vector<pair<int, int>> tmp; for (int i = 1; i <= N - 1; ++i) { // ���� �ϳ��� ����� �˼� �ִ�. int cache = Detect(i, i); board[i][i] = cache; if (cache == 1) { calSol = true; tmp.push_back(make_pair(i, i)); } } if (calSol) { if (tmp.size() == 1) { tmp.push_back(make_pair(N, N)); } int pinkpanda = (tmp[0].first < (N + 1) / 2) ? N : 1; int dt = Detect(tmp[0].first, pinkpanda); if (dt == 1) Report(tmp[0].first, tmp[1].second); else Report(tmp[1].first, tmp[0].second); } else { bool catchSol = false; for (int i = 1; i <= N / 2; ++i) { int dt = Detect(i, N + 1 - i); if (dt == 1) { catchSol = true; int dt2 = Detect(i, N + 1 - i - 1); if (dt2 == 1) Report(i, i); else Report(N + 1 - i, N + 1 - i); break; } } if (catchSol == false) { int solX = (N + 1) / 2; int solY = (N + 1) / 2; Report(solX, solY); } } // Ȧ���� ��쵵 ó�� return; }
#Verdict Execution timeMemoryGrader output
Fetching results...