Submission #126630

#TimeUsernameProblemLanguageResultExecution timeMemory
126630eriksuenderhaufTreasure (different grader from official contest) (CEOI13_treasure2)C++11
Compilation error
0 ms0 KiB
//#pragma GCC optimize("O3") #include <bits/stdc++.h> #include "treasure.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define mem(a,v) memset((a), (v), sizeof (a)) #define enl printf("\n") #define case(t) printf("Case #%d: ", (t)) #define ni(n) scanf("%d", &(n)) #define nl(n) scanf("%lld", &(n)) #define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i]) #define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i]) #define pri(n) printf("%d\n", (n)) #define prl(n) printf("%lld\n", (n)) #define pii pair<int, int> #define pil pair<int, long long> #define pll pair<long long, long long> #define vii vector<pii> #define vil vector<pil> #define vll vector<pll> #define vi vector<int> #define vl vector<long long> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef cc_hash_table<int,int,hash<int>> ht; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset; const double pi = acos(-1); const int MOD = 1e9 + 7; const int INF = 1e9 + 7; const int MAXN = 1e2 + 5; const double eps = 1e-9; int a[MAXN][MAXN], n, t[MAXN][MAXN]; map<pair<pii,pii>,int> dp; int qry(int x1, int y1, int x2, int y2) { if (dp.count(mp(mp(x1,y1),mp(x2,y2)))) return dp[mp(mp(x1,y1),mp(x2,y2))]; int ret = countTreasure(x1, y1, x2, y2); dp[mp(mp(x1,y1),mp(x2,y2))] = ret; return ret; } int g(int i, int j) { int tl = i * j + (i-1) * j + i * (j-1) + (i-1)*(j-1); int bl = (n-i+1)*j+(n-i)*j+(n-i+1)*(j-1)+(n-i)*(j-1); int tr = i*(n-j+1)+(i-1)*(n-j+1)+i*(n-j)+(i-1)*(n-j); int br = (n-i+1)*(n-j+1)+(n-i)*(n-j+1)+(n-i+1)*(n-j)+(n-i)*(n-j); int mx = max(max(tl,bl), max(tr, br)); if (mx == tl) t[i][j] = 1; else if (mx == bl) t[i][j] = 2; else if (mx == tr) t[i][j] = 3; else t[i][j] = 4; } int f(int i, int j) { if (t[i][j] == 1) return qry(1,1,i,j)-qry(1,1,i-1,j)-qry(1,1,i,j-1)+qry(1,1,i-1,j-1); if (t[i][j] == 2) return qry(i,1,n,j)-qry(i+1,1,n,j)-qry(i,1,n,j-1)+qry(i+1,1,n,j-1); if (t[i][j] == 3) return qry(1,j,i,n)-qry(1,j,i-1,n)-qry(1,j+1,i,n)+qry(1,j+1,i-1,n); return qry(i,j,n,n)-qry(i+1,j,n,n)-qry(i,j+1,n,n)+qry(i+1,j+1,n,n); } //int main() { void findTreasure(int N) { mt19937 rng(chrono::steady_clock::now().time_since_last_epoch().count()); mem(a, -1); n = N; //ni(n); vii tmp; srand(time(0)); int cnt = qry(1,1,n,n), val = 0; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) { tmp.pb(mp(i,j)); g(i, j); } shuffle(tmp.begin(), tmp.end(), rng); int fl = 1; if (cnt * 2 > n * n) { fl = 0; cnt = n * n - cnt; } while (!tmp.empty()) { pii cur = tmp.back(); tmp.pop_back(); a[cur.fi][cur.se] = f(cur.fi, cur.se); if (a[cur.fi][cur.se] == fl) val++; if (val == cnt) break; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (a[i][j] == -1) a[i][j] = 1 - fl; if (a[i][j]) Report(i, j); } } //return 0; }

Compilation message (stderr)

treasure.cpp: In function 'int g(int, int)':
treasure.cpp:63:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:77:42: error: 'std::chrono::_V2::steady_clock::time_point {aka struct std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >}' has no member named 'time_since_last_epoch'; did you mean 'time_since_epoch'?
  mt19937 rng(chrono::steady_clock::now().time_since_last_epoch().count());
                                          ^~~~~~~~~~~~~~~~~~~~~
                                          time_since_epoch