Submission #304521

#TimeUsernameProblemLanguageResultExecution timeMemory
304521DeD_TihoNConnecting Supertrees (IOI20_supertrees)C++14
21 / 100
267 ms22520 KiB
#pragma GCC optimize ("Ofast") #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,sse,sse2,ssse3,tune=native") #include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define ff first #define ss second #define pb push_back #define mp make_pair #define ll long long #define ld long double #define endl '\n' #define all(a) a.begin(),a.end() #define ull unsigned long long #define y1 asjdlfaskavslbcjasndscf #define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define iter set< int >::iterator #define iter1 multiset<int>::iterator using namespace std; using namespace __gnu_pbds; template<class T> using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; template<class T> using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count()); //find_by_order //order_of_key //const int MAX_MEM=4e8; //int mpos=0; //char mem[MAX_MEM]; // //inline void * operator new(size_t n){ // char *res=mem+mpos; // mpos+=n; // if (mpos>=MAX_MEM){ // cout<<"BAD"<<endl; // exit(0); // } // return (void*)res; //} // //inline void operator delete(void *) {} const int N=1000+5; const int inf=1e9+1e9; const int mod=1e9+7; const ld eps=1e-9; #define COL 1 #if COL #include "supertrees.h" #include <vector> #endif void add(int x,int y,vector<vector<int>>&ans) { ans[x][y]=1; ans[y][x]=1; } int construct(vector<vector<int>> p) { int n = p.size(); vector<vector<int>> ans; for (int i = 0; i < n; i++) { vector<int> row; row.resize(n); ans.push_back(row); } bitset<N>used1[n],used2[n]; for (int i=0;i<n;++i){ for (int j=0;j<n;++j){ if (j==i)continue; if (p[i][j]==1 || p[i][j]==2){ used1[i][j]=1; } if (p[i][j]==2){ used2[i][j]=1; } } } for (int i=0;i<n;++i){ vector<int>ver; for (int j=0;j<n;++j){ if (used1[i][j] || i==j){ ver.pb(j); } } bitset<N>c=used1[i]; c[i]=1; for (int j=0;j<ver.size();++j){ int v=ver[j]; bitset<N>c1=used1[v]; c1[v]=1; if (c!=c1){ return 0; } } for (int j=0;j<(int)ver.size()-1;++j){ add(ver[j],ver[j+1],ans); } } #if !COL for (int i=0;i<ans.size();++i){ for (int j=0;j<ans.size();++j){ cout<<ans[i][j]<<' '; } cout<<endl; } #endif #if COL build(ans); #endif return 1; } #if !COL main () { ios; construct({ {1,1,1,1,1}, {1,1,1,1,1}, {1,1,1,1,1}, {1,1,1,1,1}, {1,1,1,1,1}, }); } #endif //4 //1 2 1 0 //1 3 1 0 //3 4 1 1

Compilation message (stderr)

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:101:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  101 |         for (int j=0;j<ver.size();++j){
      |                      ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...