QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#44087 | #4589. White-Black Tree | aurelion_sol | AC ✓ | 39ms | 34692kb | C++14 | 1.2kb | 2022-08-12 20:06:40 | 2022-08-12 20:06:41 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a),_=(b);i<=_;++i)
#define per(i,a,b) for(int i=(a),_=(b);i>=_;--i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define size(x) int(x.size())
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ul;
typedef __int128 LL;
typedef __uint128_t UL;
typedef double db;
typedef vector<int> VI;
const int mod=998244353;
int inc(int x,int y){return x+=y-mod,x+=x>>31&mod;}
int dec(int x,int y){return x-=y,x+=x>>31&mod;}
int mul(int x,int y){return ul(x)*y%mod;}
int inc2(int &x,int y){return x+=y-mod,x+=x>>31&mod;}
int dec2(int &x,int y){return x-=y,x+=x>>31&mod;}
int mul2(int &x,int y){return x=ul(x)*y%mod;}
int qpow(int x,int y){int z=1;for(;y;y>>=1,x=mul(x,x))if(y&1)z=mul(x,z);return z;}
const int N=1e6+10;
int n,f[N],c[N],h[N],d[N];
vector<int> G[N];
void dfs(int u){
for(int v:G[u]){
dfs(v);
h[u]=max(h[u],h[v]+1);
}
}
int main(){
scanf("%d",&n);
rep(i,2,n)scanf("%d",&f[i]),G[f[i]].pb(i);
rep(i,1,n)scanf("%d",&c[i]);
dfs(1);
rep(i,1,n)if(c[i])d[h[i]]^=1;
rep(i,0,n-1)if(d[i])puts("First"),exit(0);
puts("Second");
exit(0);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 27164kb
input:
7 1 1 1 3 3 3 0 1 1 0 0 0 1
output:
First
result:
ok single line: 'First'
Test #2:
score: 0
Accepted
time: 4ms
memory: 27100kb
input:
5 1 1 2 3 0 1 1 0 0
output:
Second
result:
ok single line: 'Second'
Test #3:
score: 0
Accepted
time: 4ms
memory: 27160kb
input:
4 1 1 1 1 1 0 1
output:
First
result:
ok single line: 'First'
Test #4:
score: 0
Accepted
time: 4ms
memory: 27160kb
input:
2 1 0 0
output:
Second
result:
ok single line: 'Second'
Test #5:
score: 0
Accepted
time: 3ms
memory: 27096kb
input:
3 1 2 0 1 1
output:
First
result:
ok single line: 'First'
Test #6:
score: 0
Accepted
time: 5ms
memory: 27160kb
input:
3 1 2 1 1 1
output:
First
result:
ok single line: 'First'
Test #7:
score: 0
Accepted
time: 6ms
memory: 27160kb
input:
3 1 1 1 1 1
output:
First
result:
ok single line: 'First'
Test #8:
score: 0
Accepted
time: 4ms
memory: 27164kb
input:
3 1 1 0 1 0
output:
First
result:
ok single line: 'First'
Test #9:
score: 0
Accepted
time: 8ms
memory: 27232kb
input:
3 1 1 0 1 1
output:
Second
result:
ok single line: 'Second'
Test #10:
score: 0
Accepted
time: 5ms
memory: 27228kb
input:
4 1 1 2 0 1 1 0
output:
First
result:
ok single line: 'First'
Test #11:
score: 0
Accepted
time: 8ms
memory: 27192kb
input:
4 1 1 1 0 1 1 1
output:
First
result:
ok single line: 'First'
Test #12:
score: 0
Accepted
time: 14ms
memory: 27140kb
input:
4 1 2 3 0 1 0 1
output:
First
result:
ok single line: 'First'
Test #13:
score: 0
Accepted
time: 9ms
memory: 27024kb
input:
5 1 1 2 2 0 1 1 1 1
output:
First
result:
ok single line: 'First'
Test #14:
score: 0
Accepted
time: 7ms
memory: 27232kb
input:
5 1 1 2 2 0 0 1 0 1
output:
Second
result:
ok single line: 'Second'
Test #15:
score: 0
Accepted
time: 2ms
memory: 26964kb
input:
2 1 1 0
output:
First
result:
ok single line: 'First'
Test #16:
score: 0
Accepted
time: 3ms
memory: 27080kb
input:
5 1 1 2 2 0 1 1 0 0
output:
First
result:
ok single line: 'First'
Test #17:
score: 0
Accepted
time: 10ms
memory: 27164kb
input:
5 1 1 1 2 0 1 1 1 1
output:
First
result:
ok single line: 'First'
Test #18:
score: 0
Accepted
time: 12ms
memory: 27160kb
input:
5 1 1 1 2 0 1 1 1 1
output:
First
result:
ok single line: 'First'
Test #19:
score: 0
Accepted
time: 3ms
memory: 27216kb
input:
5 1 1 2 3 0 1 1 1 1
output:
Second
result:
ok single line: 'Second'
Test #20:
score: 0
Accepted
time: 7ms
memory: 27096kb
input:
5 1 1 2 3 0 1 1 1 0
output:
First
result:
ok single line: 'First'
Test #21:
score: 0
Accepted
time: 2ms
memory: 27084kb
input:
6 1 1 1 3 3 0 1 0 1 1 1
output:
Second
result:
ok single line: 'Second'
Test #22:
score: 0
Accepted
time: 1ms
memory: 27172kb
input:
6 1 1 1 3 3 0 1 1 0 1 1
output:
First
result:
ok single line: 'First'
Test #23:
score: 0
Accepted
time: 8ms
memory: 27192kb
input:
8 1 2 3 4 5 6 7 0 1 1 1 1 1 1 1
output:
First
result:
ok single line: 'First'
Test #24:
score: 0
Accepted
time: 8ms
memory: 27092kb
input:
10 1 1 1 2 3 4 5 6 7 0 1 1 1 1 1 1 1 1 1
output:
First
result:
ok single line: 'First'
Test #25:
score: 0
Accepted
time: 7ms
memory: 26968kb
input:
15 1 1 2 2 3 3 4 4 5 5 6 6 7 7 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1
output:
First
result:
ok single line: 'First'
Test #26:
score: 0
Accepted
time: 11ms
memory: 27160kb
input:
2 1 0 1
output:
First
result:
ok single line: 'First'
Test #27:
score: 0
Accepted
time: 7ms
memory: 27192kb
input:
13 1 1 1 2 3 4 5 6 7 8 9 10 0 1 1 1 1 1 1 1 1 1 1 1 1
output:
First
result:
ok single line: 'First'
Test #28:
score: 0
Accepted
time: 8ms
memory: 27100kb
input:
32 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
output:
First
result:
ok single line: 'First'
Test #29:
score: 0
Accepted
time: 3ms
memory: 27172kb
input:
33 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
output:
First
result:
ok single line: 'First'
Test #30:
score: 0
Accepted
time: 6ms
memory: 27104kb
input:
34 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
output:
First
result:
ok single line: 'First'
Test #31:
score: 0
Accepted
time: 9ms
memory: 27184kb
input:
256 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
output:
First
result:
ok single line: 'First'
Test #32:
score: 0
Accepted
time: 3ms
memory: 27180kb
input:
257 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
output:
First
result:
ok single line: 'First'
Test #33:
score: 0
Accepted
time: 0ms
memory: 27112kb
input:
258 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
output:
First
result:
ok single line: 'First'
Test #34:
score: 0
Accepted
time: 39ms
memory: 29888kb
input:
100000 1 2 3 4 4 6 4 7 4 7 8 5 6 5 14 1 17 5 8 10 17 18 13 12 15 11 25 24 3 11 3 21 1 13 30 35 29 6 34 35 41 20 35 36 21 24 37 33 6 37 33 31 8 30 52 43 30 7 25 29 17 12 49 48 30 15 39 10 2 23 44 11 45 17 47 30 73 71 54 36 30 51 37 76 60 9 6 86 60 59 62 16 20 34 13 73 31 60 37 33 58 4 46 66 104 102 1...
output:
First
result:
ok single line: 'First'
Test #35:
score: 0
Accepted
time: 30ms
memory: 29632kb
input:
99999 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
Second
result:
ok single line: 'Second'
Test #36:
score: 0
Accepted
time: 23ms
memory: 31552kb
input:
99999 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
Second
result:
ok single line: 'Second'
Test #37:
score: 0
Accepted
time: 1ms
memory: 27228kb
input:
2 1 1 1
output:
First
result:
ok single line: 'First'
Test #38:
score: 0
Accepted
time: 24ms
memory: 29676kb
input:
99999 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
First
result:
ok single line: 'First'
Test #39:
score: 0
Accepted
time: 19ms
memory: 28632kb
input:
65535 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
First
result:
ok single line: 'First'
Test #40:
score: 0
Accepted
time: 14ms
memory: 28688kb
input:
65535 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
Second
result:
ok single line: 'Second'
Test #41:
score: 0
Accepted
time: 16ms
memory: 28836kb
input:
65535 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
First
result:
ok single line: 'First'
Test #42:
score: 0
Accepted
time: 21ms
memory: 28748kb
input:
65535 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
First
result:
ok single line: 'First'
Test #43:
score: 0
Accepted
time: 23ms
memory: 28732kb
input:
65535 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
Second
result:
ok single line: 'Second'
Test #44:
score: 0
Accepted
time: 15ms
memory: 28692kb
input:
65535 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
Second
result:
ok single line: 'Second'
Test #45:
score: 0
Accepted
time: 17ms
memory: 28896kb
input:
65535 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
First
result:
ok single line: 'First'
Test #46:
score: 0
Accepted
time: 26ms
memory: 34224kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
Second
result:
ok single line: 'Second'
Test #47:
score: 0
Accepted
time: 26ms
memory: 34632kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
First
result:
ok single line: 'First'
Test #48:
score: 0
Accepted
time: 8ms
memory: 26968kb
input:
3 1 2 1 0 0
output:
First
result:
ok single line: 'First'
Test #49:
score: 0
Accepted
time: 20ms
memory: 27976kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
First
result:
ok single line: 'First'
Test #50:
score: 0
Accepted
time: 17ms
memory: 28208kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
Second
result:
ok single line: 'Second'
Test #51:
score: 0
Accepted
time: 36ms
memory: 30328kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
Second
result:
ok single line: 'Second'
Test #52:
score: 0
Accepted
time: 21ms
memory: 30364kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
Second
result:
ok single line: 'Second'
Test #53:
score: 0
Accepted
time: 22ms
memory: 30236kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
First
result:
ok single line: 'First'
Test #54:
score: 0
Accepted
time: 24ms
memory: 30316kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
First
result:
ok single line: 'First'
Test #55:
score: 0
Accepted
time: 16ms
memory: 29968kb
input:
100000 1 1 2 2 2 6 7 8 2 4 8 12 5 4 2 3 7 12 3 14 8 17 3 13 22 7 7 24 7 18 17 5 3 33 33 31 9 36 11 10 32 15 3 29 27 15 46 2 21 12 27 47 44 17 16 30 50 26 30 14 12 10 51 12 3 46 29 4 8 56 12 49 12 28 67 28 72 9 8 9 45 51 27 82 29 10 86 72 75 55 52 89 14 92 64 52 8 80 58 67 36 30 7 100 43 92 24 10 90 ...
output:
First
result:
ok single line: 'First'
Test #56:
score: 0
Accepted
time: 27ms
memory: 34672kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
First
result:
ok single line: 'First'
Test #57:
score: 0
Accepted
time: 29ms
memory: 30240kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
First
result:
ok single line: 'First'
Test #58:
score: 0
Accepted
time: 12ms
memory: 28540kb
input:
100000 1 1 2 2 2 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 14 14 14...
output:
First
result:
ok single line: 'First'
Test #59:
score: 0
Accepted
time: 7ms
memory: 27096kb
input:
3 1 2 0 1 0
output:
First
result:
ok single line: 'First'
Test #60:
score: 0
Accepted
time: 24ms
memory: 30528kb
input:
100000 1 1 3 4 5 6 7 7 9 10 11 12 13 13 15 16 17 17 19 20 21 22 23 16 25 26 5 28 29 11 3 18 33 34 34 35 36 38 39 40 41 42 43 44 45 43 42 41 44 46 51 52 52 54 54 53 57 58 58 60 59 60 63 62 59 55 67 68 69 70 71 67 73 74 72 76 77 78 76 68 80 81 83 83 85 86 23 88 89 90 37 92 93 93 92 96 96 97 99 100 101...
output:
First
result:
ok single line: 'First'
Test #61:
score: 0
Accepted
time: 20ms
memory: 28852kb
input:
100000 1 1 1 2 2 1 2 1 2 5 1 5 11 1 2 5 14 11 11 11 18 1 18 22 14 18 18 22 2 25 22 18 18 5 22 11 18 11 22 11 31 25 22 25 2 31 14 25 22 18 2 31 18 22 5 25 2 2 14 25 2 5 5 1 1 42 1 67 67 11 67 5 25 1 1 25 42 31 69 80 80 5 25 5 1 5 22 1 5 81 1 11 80 80 42 14 5 18 5 5 67 2 31 14 42 1 25 31 18 1 25 5 81 ...
output:
First
result:
ok single line: 'First'
Test #62:
score: 0
Accepted
time: 23ms
memory: 29748kb
input:
100000 1 1 2 3 3 6 1 2 6 3 7 1 9 12 10 5 4 5 19 2 7 10 7 24 13 19 16 16 21 28 30 28 4 9 13 6 20 30 31 11 34 37 25 32 9 2 38 31 40 36 50 1 23 45 41 30 50 28 31 11 8 30 8 20 12 13 28 26 12 7 30 31 69 44 49 21 10 7 21 73 72 66 8 7 25 65 4 57 71 20 67 31 11 85 60 66 14 45 17 35 34 78 10 26 17 9 83 40 9 ...
output:
First
result:
ok single line: 'First'
Test #63:
score: 0
Accepted
time: 32ms
memory: 34692kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
First
result:
ok single line: 'First'
Test #64:
score: 0
Accepted
time: 33ms
memory: 30184kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
First
result:
ok single line: 'First'
Test #65:
score: 0
Accepted
time: 17ms
memory: 28500kb
input:
100000 1 1 2 2 2 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 14 14 14...
output:
First
result:
ok single line: 'First'
Test #66:
score: 0
Accepted
time: 32ms
memory: 30644kb
input:
100000 1 2 3 4 3 6 2 8 5 10 11 12 12 14 15 15 17 18 13 20 21 22 23 21 25 26 20 17 29 29 30 32 33 32 35 34 37 36 39 39 33 38 43 27 45 46 46 47 49 24 51 52 53 53 51 54 55 58 58 60 61 62 63 64 65 60 67 68 68 67 71 61 73 74 75 76 77 78 79 80 81 82 82 83 83 81 78 75 89 89 91 92 93 94 95 96 97 98 97 96 84...
output:
First
result:
ok single line: 'First'
Test #67:
score: 0
Accepted
time: 20ms
memory: 28908kb
input:
100000 1 1 1 1 1 1 1 2 9 10 11 9 10 10 2 12 17 12 18 17 9 12 20 24 12 24 9 1 10 11 11 9 11 25 11 17 20 24 20 35 20 35 10 2 2 18 2 2 41 24 11 20 9 17 35 10 18 17 41 50 17 1 35 35 9 17 1 20 12 10 17 35 2 17 24 11 41 41 18 20 9 17 12 12 17 25 9 24 41 20 17 17 41 11 9 20 61 9 98 98 98 50 100 20 10 25 17...
output:
First
result:
ok single line: 'First'
Test #68:
score: 0
Accepted
time: 29ms
memory: 29884kb
input:
100000 1 1 3 2 3 4 3 3 6 5 8 12 1 13 11 14 6 3 12 9 8 14 19 7 18 9 11 8 15 5 27 20 2 19 13 1 30 37 14 16 18 2 11 39 37 35 36 10 2 50 51 12 5 26 55 16 48 23 3 29 55 24 42 29 58 58 10 28 44 46 70 21 14 16 14 66 33 13 47 26 14 51 65 11 23 2 46 75 82 69 75 2 64 42 86 89 75 14 98 47 74 25 16 40 10 10 74 ...
output:
First
result:
ok single line: 'First'
Test #69:
score: 0
Accepted
time: 31ms
memory: 34548kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
First
result:
ok single line: 'First'
Test #70:
score: 0
Accepted
time: 5ms
memory: 27164kb
input:
3 1 2 1 1 0
output:
First
result:
ok single line: 'First'
Test #71:
score: 0
Accepted
time: 23ms
memory: 30352kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
First
result:
ok single line: 'First'
Test #72:
score: 0
Accepted
time: 14ms
memory: 28536kb
input:
100000 1 1 2 2 2 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 14 14 14...
output:
First
result:
ok single line: 'First'
Test #73:
score: 0
Accepted
time: 26ms
memory: 30648kb
input:
100000 1 2 1 4 5 6 6 4 5 10 11 12 13 14 15 16 17 16 18 19 21 20 17 24 24 26 27 28 29 22 31 32 33 34 23 36 37 38 39 40 40 42 43 43 45 46 46 47 49 50 51 51 53 53 55 54 56 55 59 60 60 61 50 49 62 66 66 67 69 70 71 58 36 74 75 74 75 76 79 41 81 81 83 67 85 57 73 84 89 88 90 92 93 94 95 95 97 98 99 97 10...
output:
First
result:
ok single line: 'First'
Test #74:
score: 0
Accepted
time: 17ms
memory: 28832kb
input:
100000 1 1 2 1 1 1 1 2 1 1 2 2 4 2 1 2 2 14 19 14 20 19 1 14 19 2 19 20 1 14 22 20 22 2 1 19 32 4 19 32 20 2 1 22 14 19 38 22 20 2 32 38 1 38 22 22 32 20 14 4 14 19 32 20 32 1 48 48 22 1 68 20 48 72 1 68 19 2 20 75 32 32 72 22 48 75 1 38 72 19 38 4 75 19 75 72 1 19 1 48 22 2 22 19 72 14 72 19 32 14 ...
output:
First
result:
ok single line: 'First'
Test #75:
score: 0
Accepted
time: 28ms
memory: 29888kb
input:
100000 1 2 3 1 4 2 1 8 5 6 8 5 13 6 6 2 4 17 9 9 1 10 11 14 7 7 12 15 17 18 18 29 23 11 11 14 31 2 6 14 40 3 35 42 14 39 42 37 46 37 32 27 26 14 19 50 31 41 14 46 3 61 53 24 61 43 52 28 6 4 51 13 61 21 21 38 39 22 15 42 2 63 31 12 14 32 25 47 38 57 49 77 58 1 16 8 3 3 28 71 79 71 37 70 89 48 46 94 2...
output:
First
result:
ok single line: 'First'
Test #76:
score: 0
Accepted
time: 15ms
memory: 34432kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
First
result:
ok single line: 'First'
Test #77:
score: 0
Accepted
time: 23ms
memory: 30252kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
First
result:
ok single line: 'First'
Test #78:
score: 0
Accepted
time: 23ms
memory: 28440kb
input:
100000 1 1 2 2 2 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 14 14 14...
output:
First
result:
ok single line: 'First'
Test #79:
score: 0
Accepted
time: 22ms
memory: 30716kb
input:
100000 1 2 3 4 4 5 7 8 9 9 11 12 13 14 15 16 17 18 19 12 13 22 23 17 25 26 27 28 29 30 30 32 33 25 35 36 37 38 32 14 41 42 42 7 45 45 46 48 49 50 51 52 53 46 55 56 57 58 48 60 61 61 63 59 62 66 67 68 64 70 71 57 73 73 74 76 76 77 78 75 81 75 82 79 85 86 87 86 89 79 91 92 93 94 95 96 95 87 47 100 72 ...
output:
First
result:
ok single line: 'First'
Test #80:
score: 0
Accepted
time: 27ms
memory: 28948kb
input:
100000 1 1 1 1 2 2 6 2 2 8 6 8 6 2 11 1 6 6 8 2 16 22 1 22 16 6 16 11 8 6 2 1 1 23 16 22 2 8 6 23 8 2 6 1 16 16 1 6 11 8 8 16 16 8 11 35 57 6 58 22 58 60 8 63 35 8 35 65 69 69 63 6 8 16 60 8 1 57 23 2 6 16 2 60 16 1 60 11 2 16 69 69 58 70 23 1 63 65 57 60 8 65 8 1 69 63 8 57 11 23 60 1 1 8 95 95 60 ...
output:
First
result:
ok single line: 'First'
Test #81:
score: 0
Accepted
time: 10ms
memory: 27164kb
input:
3 1 2 0 0 1
output:
First
result:
ok single line: 'First'
Test #82:
score: 0
Accepted
time: 31ms
memory: 29852kb
input:
100000 1 1 3 3 2 5 3 3 9 1 6 2 1 5 9 4 10 7 5 19 14 2 7 9 11 20 1 7 8 9 4 13 31 12 32 11 4 19 29 35 6 17 43 12 15 15 27 24 11 7 39 31 35 33 27 11 33 36 13 57 47 56 16 7 41 47 66 15 16 29 61 48 56 13 34 64 19 70 38 9 70 3 49 62 58 71 58 81 64 72 50 2 23 62 61 85 29 60 27 64 47 19 38 103 19 47 23 95 1...
output:
First
result:
ok single line: 'First'
Test #83:
score: 0
Accepted
time: 23ms
memory: 34532kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
First
result:
ok single line: 'First'
Test #84:
score: 0
Accepted
time: 32ms
memory: 30324kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
First
result:
ok single line: 'First'
Test #85:
score: 0
Accepted
time: 15ms
memory: 28480kb
input:
100000 1 1 2 2 2 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 14 14 14...
output:
First
result:
ok single line: 'First'
Test #86:
score: 0
Accepted
time: 34ms
memory: 30716kb
input:
100000 1 1 3 4 5 5 3 8 9 2 11 12 13 9 13 10 17 18 19 20 4 22 23 24 25 26 26 28 29 30 31 27 33 25 35 36 37 38 39 40 40 42 42 44 45 32 47 47 49 50 51 48 30 54 55 56 57 55 33 35 60 62 61 64 65 64 67 68 69 70 70 71 73 74 74 76 69 78 79 80 81 78 83 84 80 86 87 88 89 90 89 92 72 94 94 22 97 98 99 100 100 ...
output:
First
result:
ok single line: 'First'
Test #87:
score: 0
Accepted
time: 17ms
memory: 28848kb
input:
100000 1 1 2 1 2 2 4 8 9 8 2 8 10 2 9 2 1 9 10 9 14 22 4 8 9 23 22 9 27 10 4 30 9 14 10 30 2 10 33 33 10 8 33 1 22 8 33 40 8 40 22 1 2 1 1 4 4 4 10 1 49 10 2 14 62 30 62 14 4 22 23 22 33 8 9 1 40 9 40 66 2 23 27 27 14 66 27 30 23 62 4 66 1 14 81 62 33 1 33 49 10 8 14 14 49 62 30 40 62 27 62 30 9 96 ...
output:
First
result:
ok single line: 'First'
Test #88:
score: 0
Accepted
time: 33ms
memory: 30328kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
First
result:
ok single line: 'First'
Test #89:
score: 0
Accepted
time: 22ms
memory: 29952kb
input:
100000 1 1 3 4 2 5 7 4 9 5 4 11 4 1 9 15 12 14 9 7 9 3 19 17 7 26 6 18 25 29 27 19 27 11 8 26 21 17 7 30 10 34 16 18 6 17 47 41 37 31 1 6 51 48 37 31 57 30 41 27 53 39 43 40 20 44 35 38 2 17 29 51 34 27 40 17 32 65 23 10 53 9 33 58 52 50 66 78 7 8 63 48 10 80 41 86 31 9 18 29 32 95 15 97 57 46 1 4 8...
output:
First
result:
ok single line: 'First'
Test #90:
score: 0
Accepted
time: 22ms
memory: 29696kb
input:
100000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...
output:
First
result:
ok single line: 'First'
Test #91:
score: 0
Accepted
time: 11ms
memory: 27984kb
input:
99999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
First
result:
ok single line: 'First'
Test #92:
score: 0
Accepted
time: 7ms
memory: 27164kb
input:
3 1 2 1 0 1
output:
First
result:
ok single line: 'First'
Test #93:
score: 0
Accepted
time: 18ms
memory: 28172kb
input:
99999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
Second
result:
ok single line: 'Second'