Submission #40793

#TimeUsernameProblemLanguageResultExecution timeMemory
40793esspks21Treasure (different grader from official contest) (CEOI13_treasure2)C++14
4 / 100
2 ms676 KiB
#include "treasure.h" #include <vector> using namespace std; struct pos { int r, c; }; vector<pos> vt; // int countTreasure(int r1, int c1, int r2, int c2); bool findEdge(int r, int c, int n) { int res = 0; int mid = n >> 1; if (r == 1 || c == 1) res = countTreasure(r, c, r, c); else if (r < mid && c < mid) { // 왼위 res = countTreasure(r, c, n, n) - countTreasure(r + 1, c, n, n) - countTreasure(r, c + 1, n, n) + countTreasure(r + 1, c + 1, n, n); } else if (r < mid && c >= mid) { // 오위 res = countTreasure(r, 1, n, c) - countTreasure(r, 1, n, c - 1) - countTreasure(r + 1, 1, n, c) + countTreasure(r + 1, 1, n, c - 1); } else if (r >= mid && c < mid) { // 왼아 res = countTreasure(1, c, r, n) - countTreasure(1, c + 1, r, n) - countTreasure(1, c, r - 1, n) + countTreasure(1, c + 1, r - 1, n); } else { res = countTreasure(1, 1, r, c) - countTreasure(1, 1, r - 1, c) - countTreasure(1, 1, r, c - 1) + countTreasure(1, 1, r - 1, c - 1); } if (res == 1) return true; return false; } void findTreasure(int N) { //int cnt = countTreasure(1, 1, N, N); //if (cnt == 0) return; pos tmp; if(N >50) for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (findEdge(i, j, N)) { tmp.r = i; tmp.c = j; vt.push_back(tmp); } } } else for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) if (countTreasure(i, j, i, j) == 1) { tmp.r = i; tmp.c = j; vt.push_back(tmp); } for (int i = 0; i < vt.size(); i++) Report(vt[i].r, vt[i].c); return; }

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:61:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < vt.size(); i++)
                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...