제출 #440802

#제출 시각아이디문제언어결과실행 시간메모리
440802roseanne_pcy슈퍼트리 잇기 (IOI20_supertrees)C++14
11 / 100
244 ms23924 KiB
#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> #include "supertrees.h" using namespace std; typedef pair<int, int> ii; typedef vector<int> vi; typedef long long ll; #define f first #define s second #define pb push_back #define lb lower_bound #define ub upper_bound #define sz(x) (int)x.size() #define all(x) begin(x), end(x) #define rsz resize const int md = 1e9+7; const ll inf = 1e18; const int maxn = 1e3+5; template<class T> void ckmin(T &a, T b) { a = min(a, b); } template<class T> void ckmax(T &a, T b) { a = max(a, b); } int par[maxn]; void init(int *p, int n) { for(int i = 0; i< n; i++) p[i] = i; } int findset(int *p, int x) { if(p[x] == x) return x; return p[x] = findset(p, p[x]); } void unionset(int *p, int x, int y) { int a = findset(p, x); int b = findset(p, y); if(a == b) return; p[a] = b; } int construct(std::vector<std::vector<int>> p) { int n = p.size(); init(par, n); bool good = true; for(int i = 0; i< n; i++) { for(int j = i+1; j< n; j++) { if(p[i][j] == 1) { unionset(par, i, j); } else { if(findset(par, i) == findset(par, j)) { good = false; return 0; } } } } vector< vector<int> > res(n, vector<int>(n, 0)); for(int i = 0; i< n; i++) { for(int j = i+1; j< n; j++) { res[i][j] = res[j][i] = (findset(par, i) == j); } } build(res); return 1; }

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

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:56:7: warning: variable 'good' set but not used [-Wunused-but-set-variable]
   56 |  bool good = true;
      |       ^~~~
#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...