Submission #54656

#TimeUsernameProblemLanguageResultExecution timeMemory
54656andy0220Treasure (different grader from official contest) (CEOI13_treasure2)C++11
0 / 100
2 ms676 KiB
#include "treasure.h" int ans[111][111]; int BIT(int i, int j) { int k, l, imsi = 0; for(k = i; k > 0; k -= (k & -k)) { for(l = j; l > 0; l -= (j & -j)) { imsi += ans[k][l]; } } for(k = i - 1; k > 0; k -= (k & -k)) { for(l = j - 1; l > 0; l -= (j & -j)) { imsi += ans[k][l]; } } for(k = i; k > 0; k -= (k & -k)) { for(l = j - 1; l > 0; l -= (j & -j)) { imsi -= ans[k][l]; } } for(k = i - 1; k > 0; k -= (k & -k)) { for(l = j; l > 0; l -= (j & -j)) { imsi -= ans[k][l]; } } return imsi; } void findTreasure (int N) { int i, j; for(i = 1; i <= N; i++) { for(j = 1; j <= N; j++) { ans[i][j] = countTreasure(i - (i & -i) + 1, j - (j & -j) + 1, i, j); } } for(i = 1; i <= N; i++) { for(j = 1; j <= N; j++) { if(BIT(i, j)) Report(i, j); } } return; }
#Verdict Execution timeMemoryGrader output
Fetching results...