Submission #40824

#TimeUsernameProblemLanguageResultExecution timeMemory
40824hsb154Treasure (different grader from official contest) (CEOI13_treasure2)C++14
100 / 100
2 ms628 KiB
#include "treasure.h" int countTreasure(int r1, int c1, int r2, int c2); void Report(int r, int c); int map[101][101]; //#include<cstdio> void findTreasure(int N) { for (int i = N / 2 + 1; i <= N; i++) { for (int j = N / 2 + 1; j <= N; j++) { map[i][j] = countTreasure(1, 1, i, j); } } for (int i = N/2+1; i <=N; i++) { for (int j = 1; j <= N/2; j++) { map[i][j] = map[i][N] - countTreasure(1, j + 1, i, N); } } for (int i = 1; i <= N / 2; i++) { for (int j = N / 2 + 1; j <= N; j++) { map[i][j] = map[N][j] - countTreasure(i+1,1 , N, j); } } for (int i = 1; i <= N / 2; i++) { for (int j = 1; j <= N / 2; j++) { map[i][j]=map[i][N]+map[N][j]-map[N][N]+ countTreasure(i + 1, j+1, N, N); } } int check = 0; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { int up=0; int left=0; int upleft=0; if (i != 1) up = map[i - 1][j]; if (j != 1) left = map[i][j - 1]; if (i != 1 && j != 1) upleft = map[i - 1][j - 1]; if (map[i][j] != up + left - upleft) 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)");
                                  ^
treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:29:6: warning: unused variable 'check' [-Wunused-variable]
  int check = 0;
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...