Submission #302867

#TimeUsernameProblemLanguageResultExecution timeMemory
302867nadidaditConnecting Supertrees (IOI20_supertrees)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int arra[n][n],adit[n],ans[n][n]; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { ans[i][j]=0; adit[i]=0; } } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { cin>>arra[i][j]; } } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(arra[i][j]!=arra[j][i]) { cout<<"BYE"<<endl; return 0; } } } for(int i=0;i<n;i++) { if(arra[i][i]!=1) { cout<<"Biday"<<endl; return 0; } } int count=0,past; for(int i=0;i<n;i++) { vector<int>check; check.push_back(i); if(adit[i]==0) { for(int j=0;j<n;j++) { if(arra[i][j]==2) { if(adit[j]==1) { cout<<"Bad Luck"<<endl; return 0; } // cout<<"i= "<<i<<" j= "<<j<<" past= "<<past<<" count= "<<count<<" adit["<<i<<"]= "<<adit[i]<<" adit["<<j<<"]= "<<adit[j]<<" adit["<<past<<"]= "<<adit[past]<<endl; // cout<<"arra["<<i<<"]["<<j<<"]= "<<arra[i][j]<<endl; check.push_back(j); } } if(check.size()>2) { // cout<<"size= "<<check.size()<<endl; for(int i=0;i<check.size();i++) { cout<<check[i]<<" "; } cout<<endl; for(int i=0;i<check.size()-1;i++) { ans[check[i]][check[i+1]]=1; adit[check[i]]=1; ans[check[i+1]][check[i]]=1; } adit[check[check.size()-1]]=1; ans[check[0]][check[check.size()-1]]=1; ans[check[check.size()-1]][0]=1; for(int i=0;i<check.size();i++) { for(int j=0;j<check.size();j++) { if(i!=j) { if(arra[check[i]][check[j]]!=2 || arra[check[i]][check[j]]!=2) { cout<<"NO"<<endl; return 0; } else { arra[check[i]][check[j]]=0; arra[check[j]][check[i]]=0; } } } } } check.clear(); } } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(i!=j && arra[i][j]==2) { cout<<"Bye Bye"<<endl; return 0; } } } /* for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { // cout<<arra[i][j]<<" "; } cout<<endl; }*/ for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { cout<<ans[i][j]<<" "; } cout<<endl; } return 0; }

Compilation message (stderr)

supertrees.cpp: In function 'int main()':
supertrees.cpp:66:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |      for(int i=0;i<check.size();i++)
      |                  ~^~~~~~~~~~~~~
supertrees.cpp:71:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |     for(int i=0;i<check.size()-1;i++)
      |                 ~^~~~~~~~~~~~~~~
supertrees.cpp:81:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |     for(int i=0;i<check.size();i++)
      |                 ~^~~~~~~~~~~~~
supertrees.cpp:83:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |      for(int j=0;j<check.size();j++)
      |                  ~^~~~~~~~~~~~~
supertrees.cpp:42:6: warning: unused variable 'count' [-Wunused-variable]
   42 |  int count=0,past;
      |      ^~~~~
supertrees.cpp:42:14: warning: unused variable 'past' [-Wunused-variable]
   42 |  int count=0,past;
      |              ^~~~
/tmp/ccACRI6N.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccq8rvTy.o:supertrees.cpp:(.text.startup+0x0): first defined here
/tmp/ccACRI6N.o: In function `main':
grader.cpp:(.text.startup+0x3b2): undefined reference to `construct(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status