제출 #308114

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
3081142020-09-30 04:22:20tjdgus4384자매 도시 (APIO20_swap)C++14
0 / 100
3 ms4992 KiB
#include<bits/stdc++.h>
using namespace std;
vector<int> group[100010];
vector<pair<int, int> > pa[100010];
vector<pair<int, pair<int, int> > > mv;
int p[100010], cycle[100010], outd[100010], sizep[100010], cnt[100010];
int find(int x){
if(p[x] == x) return x;
return find(p[x]);
}
void init(int n, int m, vector<int> u, vector<int> v, vector<int> w){
for(int i = 0;i < n;i++){
sizep[i] = 1; p[i] = i;
group[i].push_back(i);
pa[i].push_back({0, i});
}
for(int i = 0;i < m;i++){
mv.push_back({w[i], {u[i], v[i]}});
}
sort(mv.begin(), mv.end());
/*for(int i = 0;i < m;i++){
printf("%d %d %d\n", mv[i].first, mv[i].second.first, mv[i].second.second);
}*/
for(int i = 0;i < m;i++){
int u1 = find(mv[i].second.first);
int u2 = find(mv[i].second.second);
cnt[mv[i].second.first]++; cnt[mv[i].second.second]++;
if(u1 == u2){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:38:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             for(int j = 0;j < group[u2].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...