Submission #40818

#TimeUsernameProblemLanguageResultExecution timeMemory
40818meyladyTreasure (different grader from official contest) (CEOI13_treasure2)C++14
44 / 100
2 ms860 KiB
#include "treasure.h" #include <stdio.h> int sum[104][104]; int Map[104][104]; int dp[104][104]; void init() { for (int i = 0; i < 101; i++) { for (int j = 0; j < 101; j++) { dp[i][j] = -1; } } } void findTreasure (int N) { init(); int cnt = countTreasure(1, 1, N, N); sum[N][N] = cnt; int part1, part2, part3; int k = 1; for (int i = 1; i <= N; i++) { int partial; if (i < N) { if(dp[i+1][k]==-1) dp[i+1][k] = countTreasure(i + 1, k, N, N); part1 = dp[i + 1][k]; for (int j = 1; j <= N; j++) { if (j < N) { if (dp[k][j+1] == -1) dp[k][j+1] = countTreasure(k, j + 1, N, N); part2 = dp[k][j+1]; if (dp[i + 1][j+1] == -1) dp[i + 1][j+1] = countTreasure(i + 1, j + 1, N, N); part3 = dp[i + 1][j+1]; partial = part1 + part2 - part3; } else partial = part1; sum[i][j] = cnt - partial; } } else { for (int j = 1; j < N; j++) { if (dp[k][j + 1] == -1) dp[k][j + 1] = countTreasure(k, j + 1, N, N); part2 = dp[k][j + 1]; partial = part2; sum[i][j] = cnt - partial; } } } for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { Map[i][j] = sum[i][j] - sum[i - 1][j] - sum[i][j - 1] + sum[i - 1][j - 1]; } } for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (Map[i][j] == 1)Report(i, j); } } }

Compilation message (stderr)

grader.c: In function 'int main()':
grader.c:63:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         my_assert(strlen(A[i]+1) == N, "each line of the map must contain N zeroes or ones (before loop)");
                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...