제출 #312799

#제출 시각아이디문제언어결과실행 시간메모리
312799CodeKrackerConnecting Supertrees (IOI20_supertrees)C++14
0 / 100
1 ms256 KiB
/*input */ /** Author: Kristopher Paul Date Created: 30-09-2020 **/ #include<bits/stdc++.h> #include<stdio.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define ll long long //#define int ll #define pb push_back #define INF 1e18 //#define MOD 1000000007 #define MOD 998244353 #define mp make_pair const double PI=3.141592653589793238462643383279502884197169399375105820974944; #define REP(i,n) for (int i = 0; i < n; i++) #define FOR(i,a,b) for (int i = a; i < b; i++) #define REPD(i,n) for (int i = n-1; i >= 0; i--) #define FORD(i,a,b) for (int i = a; i >= b; i--) #define remax(a,b) a = max(a,b) #define remin(a,b) a = min(a,b) #define umap map #define pii pair<int,int> #define F first #define S second #define mii map<int,int> #define vi vector<int> #define vvi vector<vi> #define itr :: iterator it #define all(v) v.begin(),v.end() #define WL(t) while(t--) #define gcd(a,b) __gcd((a),(b)) #define lcm(a,b) ((a)*(b))/gcd((a),(b)) #define out(x) cout << #x << " is " << x << endl #define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; //Uncomment for File I/O //ifstream fin("input.in") //using namespace __gnu_pbds; //typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set //typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset int ModExp(int x,int y,int m){ int res = 1; x = x % m; while (y > 0) { if (y & 1) res = (res*x) % m; y = y>>1; x = (x*x) % m; } return res; } void build(vector<vi> b); int par[1005]; int ran[1005]; int fpar(int x){ if(x == par[x]){ return x; } return par[x] = fpar(par[x]); } void uni(int u,int v){ int a = fpar(u); int b = fpar(v); if(ran[a] < ran[b]){ par[a] = b; }else if(ran[b] < ran[a]){ par[b] = a; }else{ par[a] = b; ran[b]++; } } int construct(vector<vi> p){ int n = p.size(); FOR(i,0,n){ par[i] = i; ran[i] = 1; } vector<vi> ans(n,vi(n,0)); FOR(i,0,n){ FOR(j,0,n){ if(p[i][j] == 1 && (i != j)){ uni(i,j); } } } bool vis[n] = {}; vector<vi> conp(n,vi(n,0)); FOR(i,0,n){ if(!vis[par[i]]){ vis[par[i]] = true; vi nodes; FOR(j,0,n){ if(par[j] == par[i]){ nodes.pb(j); } } int sz = nodes.size(); FOR(ind,0,nodes.size()){ if(ind != 0){ ans[nodes[ind]][nodes[ind-1]] = 1; }else{ ans[nodes[ind]][nodes[sz-1]] = 1; } if(ind != (nodes.size()-1)){ ans[nodes[ind]][nodes[ind+1]] = 1; }else{ ans[nodes[ind]][nodes[0]] = 1; } FOR(iind,0,nodes.size()){ if(ind == iind){ conp[nodes[ind]][nodes[iind]] = 1; continue; } conp[nodes[ind]][nodes[iind]] = 2; } } } } if(p != conp){ return 0; } build(ans); return 1; }

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

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:21:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 | #define FOR(i,a,b) for (int i = a; i < b; i++)
......
  115 |             FOR(ind,0,nodes.size()){
      |                 ~~~~~~~~~~~~~~~~~~    
supertrees.cpp:115:13: note: in expansion of macro 'FOR'
  115 |             FOR(ind,0,nodes.size()){
      |             ^~~
supertrees.cpp:121:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  121 |                 if(ind != (nodes.size()-1)){
      |                    ~~~~^~~~~~~~~~~~~~~~~~~
supertrees.cpp:21:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 | #define FOR(i,a,b) for (int i = a; i < b; i++)
......
  126 |                 FOR(iind,0,nodes.size()){
      |                     ~~~~~~~~~~~~~~~~~~~
supertrees.cpp:126:17: note: in expansion of macro 'FOR'
  126 |                 FOR(iind,0,nodes.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...