# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
486552 |
2021-11-12T01:41:26 Z |
julian33 |
Party (POI11_imp) |
C++14 |
|
373 ms |
332 KB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
cerr<<vars<<" = ";
string delim="";
(...,(cerr<<delim<<values,delim=", "));
cerr<<"\n";
}
#else
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {}
#endif
#define pb push_back
#define sz(x) (int)(x.size())
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> inline void maxa(T& a,T b){a=max(a,b);}
template<typename T> inline void mina(T& a,T b){a=min(a,b);}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mxN=3e3+5; //make sure this is right
const int mod=1e9+7;
struct DSU{
int uf[mxN];
void init(){memset(uf,-1,sizeof(uf));}
int find(int x){return uf[x]<0?x:uf[x]=find(uf[x]);}
bool same(int x,int y){return find(x)==find(y);}
void unite(int x,int y){
x=find(x); y=find(y);
if(x==y)
return;
if(uf[x]>uf[y])
swap(x,y);
uf[x]+=uf[y]; uf[y]=x;
}
} dsu;
int main(){
cin.sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#ifdef LOCAL
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int n,m; cin>>n>>m;
dsu.init();
for(int i=0;i<m;i++){
int a,b; cin>>a>>b;
dsu.unite(a,b);
}
int cnt=0;
for(int i=1;cnt<n/3;i++){
if(dsu.find(i)!=i) continue;
if(abs(dsu.uf[i])>=n/3){
for(int j=1;cnt<n/3;j++){
if(dsu.find(j)==i){
cout<<j<<" ";
cnt++;
}
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
332 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
328 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
324 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
99 ms |
308 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
181 ms |
204 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
233 ms |
312 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
264 ms |
332 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
307 ms |
304 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
373 ms |
308 KB |
Nie wszystkie wypisane osoby siê znaja |
2 |
Halted |
0 ms |
0 KB |
- |