제출 #295958

#제출 시각아이디문제언어결과실행 시간메모리
295958Gurban장난감 기차 (IOI17_train)C++17
0 / 100
105 ms1152 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define ss second #define ff first #define sz(a) int(a.size()) #define all(a) a.begin(),a.end() typedef long double ld; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; const ll inf = 1e18; const int mod = 1e9+7; //998244353; const int maxn = 5e3+5; const int Xg[4] = {1,0,-1,0}, Yg[4] = {0,1,0,-1}; ll modpw(ll a,ll e) {if(e==0)return 1;ll x=modpw(a*a%mod,e>>1);return e&1?x*a%mod:x;} int N,M,vis[maxn]; int jog,jog1; vi con[maxn]; vi who_wins(vi a, vi r, vi u, vi v) { N = sz(r),M = sz(u); for(int i = 0;i < M;i++) con[u[i]].pb(v[i]); vi ans; for(int i = 0;i < N;i++){ memset(vis,0,sizeof(vis)); int now = i; vis[i]=1; bool tr=0; while(1){ if(sz(con[now]) > 1 and r[now]){tr=1;break;} if(vis[con[now][0]] == 1){jog=con[now][0],jog1=now;break;} vis[now]=1; now=con[now][0]; } if(tr==0){ for(int j = jog;j != jog1;){ if(r[j]==1) tr=1; if(con[j][0]==j) j=con[j][1]; else j=con[j][0]; } if(r[jog1]==1) tr=1; } ans.pb(tr); } return ans; }
#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...