Submission #148015

#TimeUsernameProblemLanguageResultExecution timeMemory
148015abacabaTreasure (different grader from official contest) (CEOI13_treasure2)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <stdio.h> #include <assert.h> #include <string.h> using namespace __gnu_pbds; #include <stdio.h> #include <algorithm> #include <math.h> #include <random> #include <string> #include <cstring> #include <set> #include <map> #include <time.h> using namespace std; typedef tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define mp make_pair #define f first #define se second #define pb push_back #define ppb pop_back #define ll long long #define ull unsigned long long #define cntbit(x) __builtin_popcount(x) #define endl '\n' #define uset unordered_set #define umap unordered_map #define pii pair<int, int> #define ld long double #define pll pair<long long, long long> bool a[105][105]; bool check(int x1, int y1, int x2, int y2, int startx, int starty, int endx, int endy, int now, int x) { return false; } void rec(int x1, int y1, int x2, int y2, int now) { if(now == (x2 - x1 + 1) * (y2 - y1 + 1)) { for(int i = x1; i <= x2; ++i) for(int j = y1; j <= y2; ++j) a[i][j] = 1; return; } int sum = 0, midx = x1 + x2 >> 1, midy = y1 + y2 >> 1; int x = countTreasure(x1, y1, midx, midy); sum += x; if(x) rec(x1, y1, midx, midy, x); if(check(x1, x2, y1, y2, x1, y1, midx, midy, now - sum, x) || sum == now) return; x = countTreasure(midx + 1, y1, x2, midy); sum += x; if(x) rec(midx + 1, y1, x2, midy, x); if(check(x1, y1, x2, y2, midx + 1, y1, x2, midy, now - sum, x) || sum == now) return; x = countTreasure(midx + 1, midy + 1, x2, y2); sum += x; if(x) rec(midx + 1, midy + 1, x2, y2, x); if(check(x1, x2, y1, y2, midx + 1, midy + 1, x2, y2, now - sum, x) || sum == now) return; x = countTreasure(x1, midy + 1, midx, y2); sum += x; if(x) rec(x1, midy + 1, midx, y2, x); } void findTreasure (int N) { int x1 = 1, y1 = 1, x2 = N, y2 = N, x = countTreasure(1, 1, N, N); rec(1, 1, N, N, x); for(int i = 1; i <= N; ++i) for(int j = 1; j <= N; ++j) if(a[i][j]) Report(i, j); }

Compilation message (stderr)

treasure.cpp: In function 'void rec(int, int, int, int, int)':
treasure.cpp:52:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int sum = 0, midx = x1 + x2 >> 1, midy = y1 + y2 >> 1;
                      ~~~^~~~
treasure.cpp:52:46: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int sum = 0, midx = x1 + x2 >> 1, midy = y1 + y2 >> 1;
                                           ~~~^~~~
treasure.cpp:53:10: error: 'countTreasure' was not declared in this scope
  int x = countTreasure(x1, y1, midx, midy);
          ^~~~~~~~~~~~~
treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:78:42: error: 'countTreasure' was not declared in this scope
  int x1 = 1, y1 = 1, x2 = N, y2 = N, x = countTreasure(1, 1, N, N);
                                          ^~~~~~~~~~~~~
treasure.cpp:78:42: note: suggested alternative: 'findTreasure'
  int x1 = 1, y1 = 1, x2 = N, y2 = N, x = countTreasure(1, 1, N, N);
                                          ^~~~~~~~~~~~~
                                          findTreasure
treasure.cpp:83:8: error: 'Report' was not declared in this scope
        Report(i, j);
        ^~~~~~
treasure.cpp:83:8: note: suggested alternative: 'qsort'
        Report(i, j);
        ^~~~~~
        qsort
treasure.cpp:78:6: warning: unused variable 'x1' [-Wunused-variable]
  int x1 = 1, y1 = 1, x2 = N, y2 = N, x = countTreasure(1, 1, N, N);
      ^~
treasure.cpp:78:14: warning: unused variable 'y1' [-Wunused-variable]
  int x1 = 1, y1 = 1, x2 = N, y2 = N, x = countTreasure(1, 1, N, N);
              ^~
treasure.cpp:78:22: warning: unused variable 'x2' [-Wunused-variable]
  int x1 = 1, y1 = 1, x2 = N, y2 = N, x = countTreasure(1, 1, N, N);
                      ^~
treasure.cpp:78:30: warning: unused variable 'y2' [-Wunused-variable]
  int x1 = 1, y1 = 1, x2 = N, y2 = N, x = countTreasure(1, 1, N, N);
                              ^~