#include<bits/stdc++.h>
#include "Joi.h"
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=4e5+5;
const ll K=350;
const ld pi=acos(-1);
const ll INF=(1LL<<60);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
ll d[N],col[N],ti,tag[N];
vector<ll> lis,v[N];
ll f(ll id){return (id==d[id]?id:d[id]=f(d[id]));}
void DFS(ll nd,ll pa){
tag[nd]=ti++;lis.pb(nd);
for(auto i:v[nd]){
if(i==pa)continue;
DFS(i,nd);
}
lis.pb(pa);
}
void Joi(ll n,ll m,ll A[],ll B[],long long x,ll T){
REP(i,n)d[i]=i;
REP(i,m)if(f(A[i])==f(B[i]))continue;else v[A[i]].pb(B[i]),v[B[i]].pb(A[i]),d[f(A[i])]=f(B[i]);
REP(i,n)sort(v[i].begin(),v[i].end());
DFS(0,-1);
REP(i,n)MessageBoard(i,col[i]=(x>>(tag[i]%60))&1);
}
#include<bits/stdc++.h>
#include"Ioi.h"
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=4e5+5;
const ll K=350;
const ld pi=acos(-1);
const ll INF=(1LL<<60);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
ll d[N],col[N],ti,ans[N],tag[N];
vector<ll> lis,res,v[N];
ll f(ll id){return (id==d[id]?id:d[id]=f(d[id]));}
void DFS(ll nd,ll pa){
tag[nd]=ti++;lis.pb(nd);
for(auto i:v[nd]){
if(i==pa)continue;
DFS(i,nd);
}
lis.pb(pa);
}
long long Ioi(ll n,ll m,ll A[],ll B[],ll P,ll V,ll T){
REP(i,n)d[i]=i;
REP(i,m)if(f(A[i])==f(B[i]))continue;else v[A[i]].pb(B[i]),v[B[i]].pb(A[i]),d[f(A[i])]=f(B[i]);
REP(i,n)sort(v[i].begin(),v[i].end());
DFS(0,-1);
ans[P]=V;res.pb(P);
//lis.resize(unique(lis.begin(),lis.end())-lis.begin());
if(tag[P]+1>=60){
for(int i=tag[P]-1;i>=0;i--){
ans[lis[i]]=move(lis[i]);
res.pb(lis[i]);
}
}else{
for(int i=tag[P]+1;i<SZ(lis);i++){
ans[lis[i]]=move(lis[i]);
res.pb(lis[i]);
}
}
long long x=0;
for(auto i:res){
if(ans[i])x|=(1LL<<(tag[i]%60));
}
return x;
}
Compilation message
Joi.cpp:13:18: warning: overflow in conversion from 'long long int' to 'll' {aka 'int'} changes value from '1152921504606846976' to '0' [-Woverflow]
13 | const ll INF=(1LL<<60);
| ~~~~^~~~~
Ioi.cpp:13:18: warning: overflow in conversion from 'long long int' to 'll' {aka 'int'} changes value from '1152921504606846976' to '0' [-Woverflow]
13 | const ll INF=(1LL<<60);
| ~~~~^~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
19708 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
40 ms |
22444 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
19556 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
39 ms |
22340 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
39 ms |
22340 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |