Submission #667884

#TimeUsernameProblemLanguageResultExecution timeMemory
667884600MihneaTreasure (different grader from official contest) (CEOI13_treasure2)C++17
44 / 100
1 ms424 KiB
#include "treasure.h" #include <bits/stdc++.h> using namespace std; const int N = 100 + 7; int s1[N][N], s2[N][N]; bool deja = 0; bool ok; int n; int pref(int r, int c) { if (r <= 0 || c <= 0) { return 0; } if (s1[r][c] == -1) { ok = 0; } return s1[r][c]; } int suf(int r, int c) { if (r > n || c > n) { return 0; } if (s2[r][c] == -1) { ok = 0; } return s2[r][c]; } int get(int r, int c) { ok = 1; //int spref = pref(r, c) - pref(r - 1, c) - pref(r, c - 1) + pref(r - 1, c - 1); //assert(ok); int ssuf = suf(r, c) - suf(r + 1, c) - suf(r, c + 1) + suf(r + 1, c + 1); assert(ok); return ssuf; } void findTreasure(int nn) { n = nn; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { s1[i][j] = s2[i][j] = -1; } } assert(deja == 0); deja = 1; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { /// s1[i][j] = countTreasure(1, 1, i, j); s2[i][j] = countTreasure(i, j, n, n); } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (get(i, j)) { Report(i, j); } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...