Submission #465167

#TimeUsernameProblemLanguageResultExecution timeMemory
465167zxcvbnmTreasure (different grader from official contest) (CEOI13_treasure2)C++14
100 / 100
3 ms332 KiB
#include "treasure.h" #include <bits/stdc++.h> using namespace std; int pref[105][105]; void findTreasure (int N) { int n = N; int mid = n/2; for(int i = n; i >= 1; i--) { for(int j = n; j >= 1; j--) { if (i > mid && j > mid) { pref[i][j] = countTreasure(1, 1, i, j); } else if (i > mid) { pref[i][j] = pref[i][n] - countTreasure(1, j+1, i, n); } else if (j > mid) { pref[i][j] = pref[n][j] - countTreasure(i+1, 1, n, j); } else { pref[i][j] = pref[n][j] + pref[i][n] + countTreasure(i+1, j+1, n, n) - pref[n][n]; } } } for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { if (pref[i][j] - pref[i-1][j] - pref[i][j-1] + pref[i-1][j-1]) { Report(i, j); } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...