제출 #656390

#제출 시각아이디문제언어결과실행 시간메모리
656390RambaXGorilla보물 찾기 (CEOI13_treasure2)C++17
100 / 100
1 ms340 KiB
#include "treasure.h" using namespace std; /* int countTreasure(int r1, int c1, int r2, int c2); void Report(int r, int c); */ int nums[110][110] = {}; void findTreasure(int N){ int half = N / 2; for(int i = N;i > 0;i--){ for(int j = N;j > 0;j--){ if(i > half && j > half){ nums[i][j] = countTreasure(1, 1, i, j); } else if(i > half && j <= half){ nums[i][j] = nums[i][N] - countTreasure(1, j + 1, i, N); } else if(i <= half && j > half){ nums[i][j] = nums[N][j] - countTreasure(i + 1, 1, N, j); } else{ nums[i][j] = nums[i][N] + nums[N][j] + countTreasure(i + 1, j + 1, N, N) - nums[N][N]; } } } for(int i = 1;i < N + 1;i++){ for(int j = 1;j < N + 1;j++){ if(nums[i][j] - nums[i - 1][j] - nums[i][j - 1] + nums[i - 1][j - 1]){ Report(i, j); } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...