Submission #130719

#TimeUsernameProblemLanguageResultExecution timeMemory
130719yeonwanTreasure (different grader from official contest) (CEOI13_treasure2)C++14
0 / 100
9 ms504 KiB
#include "treasure.h" #include <iostream> using namespace std; int ans[103][103]; void recursively_find(int a, int b, int c, int d) { //(a,b) ~ (c,d) 까지. int cnt = countTreasure(a, b, c, d); if (cnt == 0) return; if (abs(a - c) + abs(b - d) == 1 && cnt == 1) { if (countTreasure(a, b, a, b)) ans[a][b] = 1; else ans[c][d] = 1; cout << "fuck" << endl; return; } if (cnt == (c - a + 1) * (d - b + 1)) { for (int i = a; i <= c; i++) { for (int j = b; j <= d; j++) ans[i][j] = 1; } return; } if (a == c && b == d) return; int depth = c - a ; int width = d - b ; if (depth >= width) { // 세로 >= 가로 recursively_find(a, b, a + depth/2, d); recursively_find(a + depth/2+1, b , c, d); } else { // 가로 > 세로 recursively_find(a, b, c, b+ width/2 ); recursively_find(a, b + width/2 + 1 , c, d); } } void findTreasure(int N) { recursively_find(1, 1, N, N); for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (ans[i][j]) Report(i, j); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...