Submission #384919

#TimeUsernameProblemLanguageResultExecution timeMemory
384919Ahmadsm2005슈퍼트리 잇기 (IOI20_supertrees)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.cpp" //#include "supertrees.h" using namespace std; int N,edges[1001][1001],GRP[1001],Z,FAIL,GRP2[1001],Z2; vector<vector<int>>ALL; vector<vector<int>>P; void CONNECT2(vector<int>X){ for(int i=1;i<X.size();i++){ edges[X[i]][X[i-1]]=1,edges[X[i-1]][X[i]]=1; } } void CONNECT(vector<int>X){ vector<vector<int>>CYCLE; for(int i=0;i<X.size();i++){ vector<int>TEMP; if(GRP2[X[i]]+1) continue; TEMP.push_back(X[i]); GRP2[i]=Z2; for(int l=0;l<N;l++){ if(P[X[i]][l]==1&&X[i]!=l){ if(GRP2[l]+1){ FAIL=1; return; } TEMP.push_back(l),GRP2[l]=Z2; } } for(int l=0;l<TEMP.size();l++){ int CNT=0; for(int x=0;x<TEMP.size();x++){ if(l!=x&&(P[TEMP[l]][TEMP[x]]!=1)){ FAIL=1; return; } } for(int x=0;x<N;x++) if(P[TEMP[l]][x]==1) CNT++; if(CNT!=TEMP.size()){ FAIL=1; return; } } CYCLE.push_back(TEMP); Z2++; } if(CYCLE.size()==2){ FAIL=1; return; } for(int i=1;i<CYCLE.size();i++) edges[CYCLE[i][0]][CYCLE[i-1][0]]=1,edges[CYCLE[i-1][0]][CYCLE[i][0]]=1; if(CYCLE.size()>2) edges[CYCLE.back()[0]][CYCLE[0][0]]=1,edges[CYCLE[0][0]][CYCLE.back()[0]]=1; for(int i=0;i<CYCLE.size();i++) CONNECT2(CYCLE[i]); } int construct(std::vector<std::vector<int>>p){ N=p.size(); P=p; for(int i=0;i<1001;i++) GRP[i]=-1,GRP2[i]=-1; for(int i=0;i<N;i++){ vector<int>TEMP; if(GRP[i]+1) continue; TEMP.push_back(i); GRP[i]=Z; for(int l=0;l<N;l++){ if(p[i][l]&&i!=l){ if(GRP[l]+1) return 0; TEMP.push_back(l),GRP[l]=Z; } } for(int l=0;l<TEMP.size();l++){ int CNT=0; for(int x=0;x<TEMP.size();x++){ if(l!=x&&(!p[TEMP[l]][TEMP[x]])) return 0; } for(int x=0;x<N;x++) if(p[TEMP[l]][x]) CNT++; if(CNT!=TEMP.size()) return 0; } ALL.push_back(TEMP); Z++; } for(int i=0;i<ALL.size();i++) CONNECT(ALL[i]); vector<vector<int>>ANS; for(int i=0;i<N;i++){ vector<int>FF; for(int l=0;l<N;l++) FF.push_back(edges[i][l]); ANS.push_back(FF); } if(FAIL) return 0; build(ANS); return 1; }

Compilation message (stderr)

supertrees.cpp: In function 'void CONNECT2(std::vector<int>)':
supertrees.cpp:9:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 | for(int i=1;i<X.size();i++){
      |             ~^~~~~~~~~
supertrees.cpp: In function 'void CONNECT(std::vector<int>)':
supertrees.cpp:15:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 | for(int i=0;i<X.size();i++){
      |             ~^~~~~~~~~
supertrees.cpp:30:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 | for(int l=0;l<TEMP.size();l++){
      |             ~^~~~~~~~~~~~
supertrees.cpp:32:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 | for(int x=0;x<TEMP.size();x++){
      |             ~^~~~~~~~~~~~
supertrees.cpp:41:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 | if(CNT!=TEMP.size()){
      |    ~~~^~~~~~~~~~~~~
supertrees.cpp:53:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 | for(int i=1;i<CYCLE.size();i++)
      |             ~^~~~~~~~~~~~~
supertrees.cpp:57:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 | for(int i=0;i<CYCLE.size();i++)
      |             ~^~~~~~~~~~~~~
supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:78:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 | for(int l=0;l<TEMP.size();l++){
      |             ~^~~~~~~~~~~~
supertrees.cpp:80:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 | for(int x=0;x<TEMP.size();x++){
      |             ~^~~~~~~~~~~~
supertrees.cpp:87:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   87 | if(CNT!=TEMP.size())
      |    ~~~^~~~~~~~~~~~~
supertrees.cpp:93:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   93 | for(int i=0;i<ALL.size();i++)
      |             ~^~~~~~~~~~~
/tmp/ccRZbGej.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc94EQHt.o:supertrees.cpp:(.text.startup+0x0): first defined here
/tmp/ccRZbGej.o: In function `build(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)':
grader.cpp:(.text+0x1d0): multiple definition of `build(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
/tmp/cc94EQHt.o:supertrees.cpp:(.text+0x870): first defined here
collect2: error: ld returned 1 exit status