# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
295932 |
2020-09-10T06:20:43 Z |
Gurban |
Toy Train (IOI17_train) |
C++17 |
|
111 ms |
1400 KB |
#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 = 1e5+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 con[maxn],jog,jog1;
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]]=v[i];
vi ans;
for(int i = 0;i < N;i++){
memset(vis,0,sizeof(vis));
int now=i; vis[i]=1;
while(1){
if(vis[con[now]] == 1){jog=con[now],jog1=now;break;};
vis[now]=1;
now=con[now];
}
bool tr=0;
for(int j = jog;j != jog1;j=con[j]) if(r[j]) tr=1;
if(r[jog1]) tr=1;
ans.pb(tr);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
1020 KB |
3rd lines differ - on the 11th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
640 KB |
3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
111 ms |
1152 KB |
Output is correct |
2 |
Correct |
85 ms |
1400 KB |
Output is correct |
3 |
Correct |
78 ms |
1400 KB |
Output is correct |
4 |
Incorrect |
80 ms |
1400 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
76 ms |
1144 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
75 ms |
1152 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
1020 KB |
3rd lines differ - on the 11th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |