Submission #78340

#TimeUsernameProblemLanguageResultExecution timeMemory
78340win11905Treasure (different grader from official contest) (CEOI13_treasure2)C++11
0 / 100
11 ms1040 KiB
#include "treasure.h" #include <bits/stdc++.h> using namespace std; int N; int szrow[105]; bool ans[105][105]; void recur(int sz, int l, int r) { if(l == r) return void (szrow[l] = sz); int m = l + r >> 1; int cnt = countTreasure(l, 1, m, N); recur(cnt, l, m), recur(sz - cnt, m+1, r); } void rec(int sz, int R, int l, int r) { printf("%d - %d %d -> %d\n", R, l, r, sz); if(l == r) { if(sz) ans[R][l] = true; return; } int m = l + r >> 1; int cnt = countTreasure(R, l, R, m); rec(cnt, R, l, m), rec(sz - cnt, R, m+1, r); } void findTreasure (int N) { ::N = N; int cnt = countTreasure(1, 1, N, N); recur(cnt, 1, N); for(int i = 1; i <= N; ++i) rec(szrow[i], i, 1, N), printf("%d -> %d\n", i, szrow[i]); int c = 0; for(int i = 1; i <= N; ++i) for(int j = 1; j <= N; ++j) if(ans[i][j]) Report(i, j); cout << c << endl; }

Compilation message (stderr)

treasure.cpp: In function 'void recur(int, int, int)':
treasure.cpp:12:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     int m = l + r >> 1;
             ~~^~~
treasure.cpp: In function 'void rec(int, int, int, int)':
treasure.cpp:23:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     int m = l + r >> 1;
             ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...