Submission #78342

#TimeUsernameProblemLanguageResultExecution timeMemory
78342win11905Treasure (different grader from official contest) (CEOI13_treasure2)C++11
10 / 100
2 ms688 KiB
#include "treasure.h" #include <bits/stdc++.h> using namespace std; int N; int szrow[105]; bool ans[105][105]; void rec(int sz, int R, int l, int r) { 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); int m = N >> 1; for(int i = N-1; i >= m; --i) { int val = countTreasure(1, 1, i, N); szrow[i+1] = cnt - val; cnt = val; } cnt = countTreasure(1, 1, N, N); for(int i = 2; i <= m+1; ++i) { int val = countTreasure(i, 1, N, N); szrow[i-1] = cnt - val; cnt = val; } for(int i = 1; i <= N; ++i) rec(szrow[i], i, 1, N); for(int i = 1; i <= N; ++i) for(int j = 1; j <= N; ++j) if(ans[i][j]) Report(i, j); }

Compilation message (stderr)

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