Submission #161958

#TimeUsernameProblemLanguageResultExecution timeMemory
161958kostia244Game (IOI14_game)C++14
42 / 100
1059 ms89052 KiB
#pragma GCC optimize("O3, unroll-loops") #pragma GCC target("avx,sse,sse2,avx2") #include "game.h" #include<bits/stdc++.h> #include<bits/extc++.h> using namespace __gnu_pbds; using namespace std; using ll = long long; using vi = vector<ll>; struct dsu { vi r, p, d; gp_hash_table<int, int> cnt[1500]; void init(int n) { r.resize(n+1); p.resize(n+1); d.resize(n+1, 0); for(int i = 0; i <= n; i++) p[i] = i; } int par(int i) { if(i == p[i]) return i; return p[i] = par(p[i]); } void unite(int u, int v) { u=par(u),v=par(v); if(u==v) return; if(r[u]<r[v]) swap(u, v); p[v] = u; r[u] += r[u]==r[v]; for(auto i : cnt[v]) cnt[u][i.first] += i.second; d[v]=true; } }; #define left afsjlk dsu x; set<pair<int, int>> left; int n; void initialize(int N) { n=N; x.init(n); for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) x.cnt[i][j]++; } void upd(int v) { for(int i = 0; i < n; i++) { if(x.d[i]) continue; ll z = x.cnt[i][v]; x.cnt[i][v] = 0; x.cnt[i][x.par(v)]+=z; } } int hasEdge(int u, int v) { if(u>v)swap(u, v); if((u=x.par(u))==(v=x.par(v))) return 1; //cout << x.cnt[u][v] << '\n'; int t = x.cnt[u][v];x.cnt[u][v]--, x.cnt[v][u]--; if(t==1) x.unite(u, v), upd(u), upd(v); return t==1; } //int main(){ //}

Compilation message (stderr)

game.cpp:1:40: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas]
 #pragma GCC optimize("O3, unroll-loops")
                                        ^
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
 #pragma GCC target("avx,sse,sse2,avx2")
                                       ^
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
game.cpp:2:39: warning: bad option '-f unrol
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...