제출 #317727

#제출 시각아이디문제언어결과실행 시간메모리
317727amunduzbaev슈퍼트리 잇기 (IOI20_supertrees)C++14
40 / 100
607 ms26232 KiB
//#include "grader.cpp" #include "supertrees.h" #include <bits/stdc++.h> using namespace std; #define pb(a) push_back(a) const int N=1005; int used[N]; int construct(vector<vector<int>> p) { int n = p.size(); vector<vector<int> > b(n), ones(n), twos(n); for(int i=0;i<n;i++){ b[i].resize(n); for(int j=0;j<n;j++){ b[i][j] = 0; if(i!=j && p[i][j] == 1) ones[i].pb(j); if(i!=j && p[i][j] == 2) twos[i].pb(j); if(p[i][j] == 3) return 0; } for(int j=0;j<ones[i].size(); j++){ for(int l=j+1;l<ones[i].size();l++) if(p[ones[i][j]][ones[i][l]] != 1) return 0; for(int l=0;l<twos[i].size();l++) if(p[ones[i][j]][twos[i][l]] != 2) return 0; } if(twos[i].size() == 1) return 0; for(int j=0;j<twos[i].size(); j++){ for(int l=0;l<ones[i].size();l++) if(p[twos[i][j]][ones[i][l]] != 2) return 0; for(int l=j+1;l<twos[i].size();l++) if(p[twos[i][j]][twos[i][l]] != 2) return 0; } } for(int i=0;i<n;i++){ if(used[i]) continue; for(int j=0;j<ones[i].size();j++){ used[ones[i][j]] = 1; b[i][ones[i][j]] = 1; b[ones[i][j]][i] = 1; } if(twos[i].size() == 0) continue; int j = 0, sz = twos[i].size(); b[i][twos[i][j]] = 1; b[twos[i][j]][i] = 1; for(;j<sz-1; j++){ used[twos[i][j]] = 1; b[twos[i][j]][twos[i][j+1]] = 1; b[twos[i][j+1]][twos[i][j]] = 1; } used[twos[i][j]] = 1; b[i][twos[i][j]] = 1; b[twos[i][j]][i] = 1; } build(b); return 1; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:24:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |    for(int j=0;j<ones[i].size(); j++){
      |                ~^~~~~~~~~~~~~~~
supertrees.cpp:25:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int l=j+1;l<ones[i].size();l++)
      |                   ~^~~~~~~~~~~~~~~
supertrees.cpp:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int l=0;l<twos[i].size();l++)
      |                 ~^~~~~~~~~~~~~~~
supertrees.cpp:31:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |    for(int j=0;j<twos[i].size(); j++){
      |                ~^~~~~~~~~~~~~~~
supertrees.cpp:32:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int l=0;l<ones[i].size();l++)
      |                 ~^~~~~~~~~~~~~~~
supertrees.cpp:34:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int l=j+1;l<twos[i].size();l++)
      |                   ~^~~~~~~~~~~~~~~
supertrees.cpp:40:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |    for(int j=0;j<ones[i].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...