Submission #783924

#TimeUsernameProblemLanguageResultExecution timeMemory
783924tolbiGame (IOI14_game)C++17
100 / 100
271 ms16588 KiB
#pragma optimize("Bismillahirrahmanirrahim") //█▀█─█──█──█▀█─█─█ //█▄█─█──█──█▄█─█■█ //█─█─█▄─█▄─█─█─█─█ //Allahuekber //ahmet23 orz... //FatihSultanMehmedHan //YavuzSultanSelimHan //AbdulhamidHan //Sani buyuk Osman Pasa Plevneden cikmam diyor. #define author tolbi #include<bits/stdc++.h> using namespace std; template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr){return os<<pr.first<<" "<<pr.second;} ostream& operator<<(ostream& os, bool bl){return os<<(int32_t)bl;} template<typename X> ostream& operator<<(ostream& os, vector<X> v){for(auto &it : v) os<<it<<" ";return os;} template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> v){for(auto &it : v) os<<it<<" ";return os;} #define deci(x) int x;cin>>x; #define endl '\n' #define decstr(x) string x;cin>>x; #define sortarr(x) sort(x.begin(), x.end()) #define sortrarr(x) sort(x.rbegin(), x.rend()) #define rev(x) reverse(x.begin(), x.end()) #define tol(bi) (1LL<<((int)(bi))) typedef long long ll; const ll INF = INT_MAX; const int MOD = 1e9+7; mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count()); #include "game.h" vector<vector<int>> ara; vector<int> par; vector<int> sz; int find_par(int node){ if (par[node]==node) return node; return par[node]=find_par(par[node]); } void initialize(int n) { ara.resize(n,vector<int>(n,0)); par.resize(n); iota(par.begin(), par.end(), 0); sz.resize(n,1); } int hasEdge(int u, int v) { if (find_par(u)==find_par(v)){ return 0; } u=find_par(u); v=find_par(v); if (sz[u]>sz[v]) swap(u,v); if (ara[u][v]==sz[u]*sz[v]-1){ par[v]=u; sz[u]+=sz[v]; sz[v]=0; for (int i = 0; i < par.size(); ++i) { if (find_par(i)==u || find_par(i)!=i) continue; ara[u][i]+=ara[v][i]; ara[i][u]+=ara[i][v]; ara[v][i]=ara[i][v]=0; ara[i][v]=ara[v][i]=0; } return 1; } else { ara[u][v]++; ara[v][u]++; return 0; } }

Compilation message (stderr)

game.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:54:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |   for (int i = 0; i < par.size(); ++i)
      |                   ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...