Submission #595283

#TimeUsernameProblemLanguageResultExecution timeMemory
595283Red_InsideConnecting Supertrees (IOI20_supertrees)C++17
0 / 100
1 ms212 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(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]); 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; }

Compilation message (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(1, j, vec.size())
      |          ~~~~~~~~~~~~~                 
supertrees.cpp:55:3: note: in expansion of macro 'FOR'
   55 |   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)
......
   66 |  FOR(0, i, roots.size())
      |         ~~~~~~~~~~~~~~~                
supertrees.cpp:66:2: note: in expansion of macro 'FOR'
   66 |  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)
......
   70 |   FOR(0, j, roots.size())
      |          ~~~~~~~~~~~~~~~               
supertrees.cpp:70:3: note: in expansion of macro 'FOR'
   70 |   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)
......
   79 |   FOR(1, j, vec.size())
      |          ~~~~~~~~~~~~~                 
supertrees.cpp:79:3: note: in expansion of macro 'FOR'
   79 |   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...