제출 #595286

#제출 시각아이디문제언어결과실행 시간메모리
595286Red_Inside슈퍼트리 잇기 (IOI20_supertrees)C++17
56 / 100
223 ms24268 KiB
#include "supertrees.h" #include <bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back #define mp make_pair #define o cout<<"BUG"<<endl; #define FOR(i, j, n) for(int j = i; j < n; ++j) #define forn(i, j, n) for(int j = i; j <= n; ++j) #define nfor(i, j, n) for(int j = n; j >= i; --j) #define all(v) v.begin(), v.end() #define ld long double #define ull unsigned long long using namespace std; const int maxn=1e6+10,LOG=17,mod=998244353; int block = 226, timer = 0; const ld EPS = 1e-18; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define bt(i) (1 << (i)) //#define int ll const int inf=2e9; #define y1 yy #define prev pre #define pii pair <int, int> int used[maxn], good[maxn]; int construct(vector <vector <int> > a) { int n = a[0].size(); vector <vector <int> > ans; ans = a; forn(0, i, n-1) forn(0, j, n-1) ans[i][j] = 0; vector <int> roots; forn(0, i, n-1) { if(a[i][i] != 1) return 0; if(used[i]) continue; vector <int> vec; forn(0, j, n-1) { if(a[i][j] == 1) { vec.pb(j); used[j] = 1; } } FOR(0, j, vec.size()) { forn(0, k, n-1) { if(a[i][k] == 1 && a[vec[j]][k] != 1) return 0; if(a[i][k] != 1 && a[vec[j]][k] == 1) return 0; } } FOR(1, j, vec.size()) { ans[vec[j]][vec[j-1]] = 1; ans[vec[j-1]][vec[j]] = 1; } // cout << "NEW TREE: "; // for(auto j : vec) cout << j << " "; // cout << endl; roots.pb(vec[0]); } forn(0, i, n-1) used[i] = 0; FOR(0, i, roots.size()) { if(used[i]) continue; vector <int> vec; FOR(0, j, roots.size()) { if(a[roots[i]][roots[j]] == 2) { used[j] = 1; vec.pb(roots[j]); } } vec.pb(roots[i]); if(vec.size() == 2) return 0; if(vec.size() == 1) continue; FOR(0, j, vec.size()) { FOR(j + 1, k, vec.size()) { if(a[vec[j]][vec[k]] != 2) return 0; } } FOR(1, j, vec.size()) { ans[vec[j]][vec[j-1]] = 1; ans[vec[j-1]][vec[j]] = 1; } ans[vec[0]][vec.back()] = 1; ans[vec.back()][vec[0]] = 1; } build(ans); return 1; }

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

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:12:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define FOR(i, j, n) for(int j = i; j < n; ++j)
......
   55 |   FOR(0, j, vec.size())
      |          ~~~~~~~~~~~~~                 
supertrees.cpp:55:3: note: in expansion of macro 'FOR'
   55 |   FOR(0, j, vec.size())
      |   ^~~
supertrees.cpp:12:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define FOR(i, j, n) for(int j = i; j < n; ++j)
......
   63 |   FOR(1, j, vec.size())
      |          ~~~~~~~~~~~~~                 
supertrees.cpp:63:3: note: in expansion of macro 'FOR'
   63 |   FOR(1, j, vec.size())
      |   ^~~
supertrees.cpp:12:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define FOR(i, j, n) for(int j = i; j < n; ++j)
......
   74 |  FOR(0, i, roots.size())
      |         ~~~~~~~~~~~~~~~                
supertrees.cpp:74:2: note: in expansion of macro 'FOR'
   74 |  FOR(0, i, roots.size())
      |  ^~~
supertrees.cpp:12:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define FOR(i, j, n) for(int j = i; j < n; ++j)
......
   78 |   FOR(0, j, roots.size())
      |          ~~~~~~~~~~~~~~~               
supertrees.cpp:78:3: note: in expansion of macro 'FOR'
   78 |   FOR(0, j, roots.size())
      |   ^~~
supertrees.cpp:12:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define FOR(i, j, n) for(int j = i; j < n; ++j)
......
   89 |   FOR(0, j, vec.size())
      |          ~~~~~~~~~~~~~                 
supertrees.cpp:89:3: note: in expansion of macro 'FOR'
   89 |   FOR(0, j, vec.size())
      |   ^~~
supertrees.cpp:12:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define FOR(i, j, n) for(int j = i; j < n; ++j)
......
   91 |    FOR(j + 1, k, vec.size())
      |               ~~~~~~~~~~~~~            
supertrees.cpp:91:4: note: in expansion of macro 'FOR'
   91 |    FOR(j + 1, k, vec.size())
      |    ^~~
supertrees.cpp:12:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define FOR(i, j, n) for(int j = i; j < n; ++j)
......
   96 |   FOR(1, j, vec.size())
      |          ~~~~~~~~~~~~~                 
supertrees.cpp:96:3: note: in expansion of macro 'FOR'
   96 |   FOR(1, j, vec.size())
      |   ^~~
#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...