#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 time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Correct : C = 4 |
2 |
Runtime error |
2 ms |
256 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |