Submission #362660

#TimeUsernameProblemLanguageResultExecution timeMemory
362660tndud2612Treasure (different grader from official contest) (CEOI13_treasure2)C++17
0 / 100
1 ms620 KiB
#include "treasure.h" #include <queue> #include <utility> #include <vector> using namespace std; void findTreasure (int N) { int dir = 0; int cnt = countTreasure(1, 1, N, N); if (cnt == 0) { return; } int r1 = 1; int c1 = 1; int r2 = N; int c2 = N; queue<vector<int>> q; q.push({ 1, 1, N, N }); while (cnt) { vector<int> tmp; tmp = q.front(); if (tmp[1] == tmp[3] && tmp[0] == tmp[2]) { cnt--; } q.pop(); if (dir && tmp[1] != tmp[3]) { int mid = (tmp[1] + tmp[3]) / 2; if (countTreasure(tmp[0], mid + 1, tmp[2], tmp[3])) { q.push({ tmp[0], mid + 1, tmp[2], tmp[3] }); } if (countTreasure(tmp[0], tmp[1], tmp[2], mid)) { q.push({ tmp[0], tmp[1], tmp[2], mid }); } dir = 0; } else if(!dir && tmp[0] != tmp[2]) { int mid = (tmp[0] + tmp[2]) / 2; if (countTreasure(mid + 1, tmp[1], tmp[2], tmp[3])) { q.push({ mid + 1, tmp[1], tmp[2], tmp[3] }); } if (countTreasure(mid + 1, tmp[1], tmp[2], tmp[3])) { q.push({ tmp[0], tmp[1], mid, tmp[3] }); } dir = 1; } } }

Compilation message (stderr)

treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:15:6: warning: unused variable 'r1' [-Wunused-variable]
   15 |  int r1 = 1;
      |      ^~
treasure.cpp:16:6: warning: unused variable 'c1' [-Wunused-variable]
   16 |  int c1 = 1;
      |      ^~
treasure.cpp:17:6: warning: unused variable 'r2' [-Wunused-variable]
   17 |  int r2 = N;
      |      ^~
treasure.cpp:18:6: warning: unused variable 'c2' [-Wunused-variable]
   18 |  int c2 = N;
      |      ^~
#Verdict Execution timeMemoryGrader output
Fetching results...