제출 #86164

#제출 시각아이디문제언어결과실행 시간메모리
86164faceless보물 찾기 (CEOI13_treasure2)C++14
0 / 100
295 ms263168 KiB
#include "treasure.h" bool c[120][120]; int dp[120][120]; int find (int idx, int L, int R, int cnt = -1) { if (cnt == -1) { cnt = countTreasure (1, L, idx, R - 1) - dp[idx - 1][R - 1] + dp[idx - 1][L - 1]; } if (cnt == (R - L)) { for (int j = L; j < R; j++) { c[idx][j] = 1; } return cnt; } if (cnt == 0) return cnt; int mid = (L + R) >> 1; int x = find (idx, mid, R); find (idx, L, mid, cnt - x); return cnt; } void findTreasure (int N) { for (int i = 1; i <= N; i++) { find (i, 1, N + 1); for (int j = 1; j <= N; j++) { dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1]; } } for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) if (c[i][j]) Report (i, j); }
#Verdict Execution timeMemoryGrader output
Fetching results...