QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#538017 | #4565. Rarest Insects | Yahia_Emara# | 0 | 23ms | 10336kb | C++20 | 3.0kb | 2024-08-30 20:54:31 | 2024-08-30 20:54:32 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define dbg(x) cout << (#x) << " : " << x << endl
#define pb push_back
#define bk(x) x.back()
#define all(x) x.begin(),x.end()
#define LOOP(n) for(int rp=0;rp<n;rp++)
#define sq(x) ((x)*(x))
typedef long long ll;
typedef long double dl;
const int SZ=5e5+7;
const ll INF=1e18+7;
const dl eps=1e-9;
int MOD=1e9+7;
mt19937_64 rng(time(0));
int rnd(int l,int r){
return uniform_int_distribution<int>(l,r)(rng);
}
ll trig(ll x){
return x*(x+1)/2;
}
int getN(){
int n;cin >> n;
return n;
}
#define cmbntrcs fact[0]=1;for(int i=1;i<SZ;i++)fact[i]=mul(fact[i-1],i);finv[SZ-1]=inv(fact[SZ-1]);for(int i=SZ-2;i>0;i--)finv[i]=mul(finv[i+1],i+1);
int fact[SZ],finv[SZ];
int add(int x,int y,int MOD=MOD){
x+=y;if(x>=MOD)x-=MOD;
return x;
}
int sub(int x,int y,int MOD=MOD){
x-=y;if(x<0)x+=MOD;
return x;
}
int mul(int x,int y,int MOD=MOD){
return(x*1ll*y)%MOD;
}
int pwr(int x,ll b,int MOD=MOD){
int rt=1;
while(b>0){
if(b&1)rt=mul(rt,x,MOD);
x=mul(x,x,MOD),b>>=1;
}
return rt;
}
int inv(int x,int MOD=MOD){
return pwr(x,MOD-2,MOD);
}
#include "insects.h"
//#include "stub.cpp"
int n,p[SZ],a[SZ],k,vs[SZ];
vector<int>v;
void ins(int i){
i=p[i];
vs[i]=1;
move_inside(i);
v.pb(i);
}
void dlt(){
vs[bk(v)]=0;
move_outside(bk(v));
v.pop_back();
}
void permdlt(){
vs[bk(v)]=2;
move_outside(bk(v));
v.pop_back();
}
int card(){
return press_button();
}
bool f(int C){
while(card()>C)dlt();
for(int i=0;i<n;i++){
if(vs[p[i]])continue;
ins(i);
if(card()>C)dlt();
}
if(C*k==sz(v))return 1;
return 0;
}
int min_cardinality(int N){
n=N;
for(int i=0;i<n;i++)p[i]=i,swap(p[i],p[rnd(0,i)]);
for(int i=0;i<n;i++){
ins(i);
if(card()>1)dlt();
}
k=sz(v);
if(k==1)return n;
if(k<=5){
vector<int>w=v;
while(sz(v))dlt();
for(int i=0;i<k;i++)swap(w[i],w[rnd(0,i)]);
int C=0,ans=1e9;
for(int i=0;i<k-1;i++){
ins(w[i]);
for(int i=0;i<n;i++){
if(vs[p[i]])continue;
ins(i);
if(card()!=sz(v))dlt();
}
C+=sz(v),ans=min(ans,sz(v));
while(sz(v))permdlt();
}
ans=min(ans,n-C);
return ans;
}
for(int i=0;i<k;i++)swap(v[i],v[rnd(0,i)]);
while(sz(v)>1)dlt();
for(int i=0;i<n;i++){
if(vs[p[i]])continue;
ins(i);
if(card()!=sz(v))dlt();
}
int l=2,r=min(n/k,sz(v)),ans=1;
while(l<=r){
int md=(l+r)>>1;
if(f(md))l=md+1,ans=md;
else r=md-1;
}
return ans;
}
/*int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
//cout << fixed << setprecision(12);
int tt=1;
//cin >> tt;
LOOP(tt){
//code
}
return 0;
}*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 2ms
memory: 10316kb
input:
6 1 1 1 2 2 2 1 1 1 1 1 2 2 3 3
output:
8 0 1 8 2 8 0 4 8 2 8 0 0 8 2 8 0 5 8 2 8 1 5 8 0 2 8 2 8 1 2 8 0 3 8 2 8 1 3 8 1 0 8 1 4 8 1 1 8 0 1 8 0 4 8 2 8 1 4 8 0 0 8 2 8 1 0 8 0 5 8 2 8 1 5 8 0 2 8 2 8 1 2 8 0 3 8 2 8 1 3 8 1 1 8 0 2 8 0 4 8 2 8 0 0 8 2 8 1 0 8 0 5 8 2 8 0 3 8 2 8 1 3 8 1 5 8 1 4 8 1 2 8 3 1
result:
ok
Test #2:
score: 10
Accepted
time: 1ms
memory: 10324kb
input:
2 1 2
output:
8 0 1 8 2 8 0 0 8 2 8 1 0 8 3 2
result:
ok
Test #3:
score: 10
Accepted
time: 0ms
memory: 9992kb
input:
2 1 1 1
output:
8 0 1 8 2 8 0 0 8 2 8 1 0 8 1 1 8 0 0 8 0 1 8 2 8 1 1 8 1 0 8 3 1
result:
ok
Test #4:
score: 10
Accepted
time: 0ms
memory: 10016kb
input:
3 1 2 1 2 2
output:
8 0 1 8 2 8 0 2 8 2 8 1 2 8 0 0 8 2 8 1 0 8 1 1 8 0 1 8 0 2 8 2 8 0 0 8 2 8 1 0 8 1 2 8 1 1 8 3 1
result:
ok
Test #5:
score: 10
Accepted
time: 1ms
memory: 10244kb
input:
5 1 1 2 2 2 1 2 3 3
output:
8 0 1 8 2 8 0 4 8 2 8 0 0 8 2 8 1 0 8 0 3 8 2 8 1 3 8 0 2 8 2 8 1 2 8 1 4 8 1 1 8 0 4 8 0 1 8 2 8 1 1 8 0 0 8 2 8 0 3 8 2 8 0 2 8 2 8 1 2 8 1 3 8 1 0 8 1 4 8 3 2
result:
ok
Test #6:
score: 10
Accepted
time: 1ms
memory: 10312kb
input:
8 1 2 1 2 1 2 2 2 2 2 3 3 4 5 5 1 1 1
output:
8 0 1 8 2 8 0 4 8 2 8 1 4 8 0 0 8 2 8 0 5 8 2 8 1 5 8 0 7 8 2 8 0 3 8 2 8 1 3 8 0 2 8 2 8 1 2 8 0 6 8 2 8 1 6 8 1 7 8 1 0 8 1 1 8 0 4 8 0 1 8 2 8 0 0 8 2 8 1 0 8 0 5 8 2 8 0 7 8 2 8 1 7 8 0 3 8 2 8 0 2 8 2 8 0 6 8 2 8 1 6 8 1 2 8 1 3 8 1 5 8 1 1 8 1 4 8 0 1 8 0 0 8 2 8 1 0 8 0 7 8 2 8 1 7 8 0 6 8 2 ...
result:
ok
Test #7:
score: 10
Accepted
time: 1ms
memory: 10032kb
input:
199 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 39 8 2 8 0 30 8 2 8 1 30 8 0 60 8 2 8 1 60 8 0 109 8 2 8 1 109 8 0 149 8 2 8 1 149 8 0 123 8 2 8 1 123 8 0 127 8 2 8 1 127 8 0 49 8 2 8 1 49 8 0 197 8 2 8 1 197 8 0 129 8 2 8 1 129 8 0 112 8 2 8 1 112 8 0 130 8 2 8 1 130 8 0 73 8 2 8 1 73 8 0 82 8 2 8 1 82 8 0 15 8 2 8 1 15 8 0 107 8 2 8 1 107 8...
result:
ok
Test #8:
score: 10
Accepted
time: 5ms
memory: 10324kb
input:
200 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
8 0 39 8 2 8 0 30 8 2 8 0 60 8 2 8 0 109 8 2 8 0 149 8 2 8 0 123 8 2 8 0 127 8 2 8 0 49 8 2 8 0 197 8 2 8 0 129 8 2 8 0 112 8 2 8 0 130 8 2 8 0 73 8 2 8 0 82 8 2 8 0 15 8 2 8 0 107 8 2 8 0 27 8 2 8 0 166 8 2 8 0 55 8 2 8 0 110 8 2 8 0 173 8 2 8 0 36 8 2 8 0 86 8 2 8 0 40 8 2 8 0 46 8 2 8 0 64 8 2 8 ...
result:
ok
Test #9:
score: 10
Accepted
time: 0ms
memory: 10096kb
input:
200 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 39 8 2 8 0 30 8 2 8 0 60 8 2 8 0 109 8 2 8 0 149 8 2 8 1 149 8 0 123 8 2 8 0 127 8 2 8 0 49 8 2 8 1 49 8 0 197 8 2 8 0 129 8 2 8 0 112 8 2 8 0 130 8 2 8 0 73 8 2 8 1 73 8 0 82 8 2 8 0 15 8 2 8 0 107 8 2 8 1 107 8 0 27 8 2 8 1 27 8 0 166 8 2 8 1 166 8 0 55 8 2 8 0 110 8 2 8 1 110 8 0 173 8 2 8 1 ...
result:
ok
Test #10:
score: 10
Accepted
time: 0ms
memory: 8212kb
input:
198 1 1 1 1 1 1 1 1 1 2 2 2 2 1 2 2 1 1 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 39 8 2 8 0 30 8 2 8 0 60 8 2 8 0 109 8 2 8 0 149 8 2 8 0 123 8 2 8 0 127 8 2 8 0 49 8 2 8 0 197 8 2 8 0 129 8 2 8 1 129 8 0 112 8 2 8 1 112 8 0 130 8 2 8 1 130 8 0 73 8 2 8 1 73 8 0 82 8 2 8 0 15 8 2 8 1 15 8 0 107 8 2 8 1 107 8 0 27 8 2 8 0 166 8 2 8 0 55 8 2 8 1 55 8 0 110 8 2 8 1 110 8 0 173 ...
result:
ok
Test #11:
score: 10
Accepted
time: 4ms
memory: 10020kb
input:
199 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 39 8 2 8 0 30 8 2 8 1 30 8 0 60 8 2 8 1 60 8 0 109 8 2 8 1 109 8 0 149 8 2 8 1 149 8 0 123 8 2 8 1 123 8 0 127 8 2 8 1 127 8 0 49 8 2 8 1 49 8 0 197 8 2 8 1 197 8 0 129 8 2 8 1 129 8 0 112 8 2 8 1 112 8 0 130 8 2 8 1 130 8 0 73 8 2 8 1 73 8 0 82 8 2 8 1 82 8 0 15 8 2 8 1 15 8 0 107 8 2 8 1 107 8...
result:
ok
Test #12:
score: 10
Accepted
time: 0ms
memory: 9968kb
input:
197 1 1 1 1 2 1 1 2 1 2 2 2 2 1 2 1 2 2 2 2 1 1 1 1 1 1 1 1 1 2 2 2 2 1 2 2 1 2 1 2 2 1 1 1 2 2 1 1 1 1 1 2 1 2 1 2 1 2 2 2 2 2 1 2 1 2 2 1 1 1 1 2 1 1 1 2 1 1 1 1 2 1 2 2 2 2 2 2 2 2 1 1 2 2 1 1 1 1 2 2 1 1 2 1 2 1 2 1 2 2 2 1 2 1 2 1 2 2 2 1 2 1 2 2 2 1 2 1 1 2 2 2 1 2 1 1 1 2 2 1 1 2 1 1 2 1 1 2 ...
output:
8 0 39 8 2 8 0 30 8 2 8 0 60 8 2 8 0 109 8 2 8 0 149 8 2 8 1 149 8 0 123 8 2 8 0 127 8 2 8 0 49 8 2 8 1 49 8 0 51 8 2 8 0 129 8 2 8 1 129 8 0 112 8 2 8 1 112 8 0 130 8 2 8 1 130 8 0 73 8 2 8 1 73 8 0 82 8 2 8 0 15 8 2 8 1 15 8 0 107 8 2 8 0 27 8 2 8 1 27 8 0 166 8 2 8 1 166 8 0 55 8 2 8 1 55 8 0 110...
result:
ok
Test #13:
score: 0
Wrong Answer
time: 0ms
memory: 10084kb
input:
197 1 1 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 39 8 2 8 0 30 8 2 8 0 60 8 2 8 1 60 8 0 109 8 2 8 0 149 8 2 8 0 123 8 2 8 1 123 8 0 127 8 2 8 1 127 8 0 49 8 2 8 1 49 8 0 51 8 2 8 1 51 8 0 129 8 2 8 1 129 8 0 112 8 2 8 1 112 8 0 130 8 2 8 1 130 8 0 73 8 2 8 1 73 8 0 82 8 2 8 1 82 8 0 15 8 2 8 1 15 8 0 107 8 2 8 1 107 8 0 27 8 2 8 1 27 8 0 166 ...
result:
wrong answer Wrong answer.
Subtask #2:
score: 0
Wrong Answer
Test #24:
score: 15
Accepted
time: 7ms
memory: 10024kb
input:
1000 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 803 8 2 8 0 452 8 2 8 1 452 8 0 420 8 2 8 1 420 8 0 945 8 2 8 1 945 8 0 352 8 2 8 1 352 8 0 324 8 2 8 1 324 8 0 441 8 2 8 1 441 8 0 49 8 2 8 1 49 8 0 972 8 2 8 1 972 8 0 979 8 2 8 1 979 8 0 112 8 2 8 1 112 8 0 795 8 2 8 1 795 8 0 646 8 2 8 1 646 8 0 82 8 2 8 1 82 8 0 15 8 2 8 1 15 8 0 107 8 2 8 ...
result:
ok
Test #25:
score: 15
Accepted
time: 0ms
memory: 10108kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
8 0 803 8 2 8 0 452 8 2 8 0 420 8 2 8 0 945 8 2 8 0 352 8 2 8 0 324 8 2 8 0 441 8 2 8 0 49 8 2 8 0 972 8 2 8 0 979 8 2 8 0 112 8 2 8 0 795 8 2 8 0 646 8 2 8 0 82 8 2 8 0 15 8 2 8 0 107 8 2 8 0 639 8 2 8 0 232 8 2 8 0 628 8 2 8 0 110 8 2 8 0 681 8 2 8 0 675 8 2 8 0 571 8 2 8 0 340 8 2 8 0 922 8 2 8 0...
result:
ok
Test #26:
score: 15
Accepted
time: 19ms
memory: 10332kb
input:
999 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 2 1 1 1 1 2 2 2 1 1 2 2 1 1 2 2 2 2 2 1 2 2 1 2 2 2 1 2 2 2 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 803 8 2 8 0 452 8 2 8 0 420 8 2 8 0 945 8 2 8 0 352 8 2 8 0 324 8 2 8 0 441 8 2 8 0 49 8 2 8 0 972 8 2 8 0 979 8 2 8 0 112 8 2 8 0 795 8 2 8 1 795 8 0 646 8 2 8 0 82 8 2 8 0 15 8 2 8 1 15 8 0 107 8 2 8 0 639 8 2 8 1 639 8 0 232 8 2 8 0 628 8 2 8 0 110 8 2 8 0 681 8 2 8 0 675 8 2 8 1 675 8 0 571 ...
result:
ok
Test #27:
score: 15
Accepted
time: 8ms
memory: 10040kb
input:
999 1 1 1 1 1 1 1 1 1 1 2 2 1 2 2 1 1 1 2 2 2 1 1 2 2 1 2 1 2 2 2 2 2 2 1 1 2 1 2 2 2 2 1 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 803 8 2 8 0 452 8 2 8 0 420 8 2 8 0 945 8 2 8 0 352 8 2 8 0 324 8 2 8 0 441 8 2 8 0 49 8 2 8 0 972 8 2 8 0 979 8 2 8 0 112 8 2 8 1 112 8 0 795 8 2 8 1 795 8 0 646 8 2 8 0 82 8 2 8 1 82 8 0 15 8 2 8 1 15 8 0 107 8 2 8 0 639 8 2 8 0 232 8 2 8 0 628 8 2 8 1 628 8 0 110 8 2 8 1 110 8 0 681 8 2 8 1 6...
result:
ok
Test #28:
score: 15
Accepted
time: 10ms
memory: 10032kb
input:
996 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 112 8 2 8 0 492 8 2 8 1 492 8 0 582 8 2 8 1 582 8 0 832 8 2 8 1 832 8 0 540 8 2 8 1 540 8 0 757 8 2 8 1 757 8 0 465 8 2 8 1 465 8 0 60 8 2 8 1 60 8 0 483 8 2 8 1 483 8 0 416 8 2 8 1 416 8 0 340 8 2 8 1 340 8 0 599 8 2 8 1 599 8 0 432 8 2 8 1 432 8 0 533 8 2 8 1 533 8 0 985 8 2 8 1 985 8 0 510 8 ...
result:
ok
Test #29:
score: 15
Accepted
time: 6ms
memory: 10320kb
input:
995 1 1 1 2 1 1 2 2 1 1 2 2 2 2 2 1 1 1 1 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 1 2 1 1 2 2 2 1 2 2 2 2 2 2 2 2 1 1 1 2 1 2 2 1 1 2 1 1 2 1 1 2 1 2 1 2 2 1 2 1 1 1 1 2 2 2 1 1 2 2 2 2 2 1 2 2 1 1 2 1 2 2 1 1 1 2 2 2 2 2 1 1 1 2 1 1 2 2 1 1 2 1 1 2 1 2 2 1 1 2 1 1 2 1 1 1 1 2 2 2 1 2 2 2 2 2 1 2 1 2 2 1 1 ...
output:
8 0 112 8 2 8 0 492 8 2 8 0 582 8 2 8 0 832 8 2 8 1 832 8 0 540 8 2 8 0 757 8 2 8 0 465 8 2 8 1 465 8 0 60 8 2 8 1 60 8 0 483 8 2 8 0 416 8 2 8 0 340 8 2 8 1 340 8 0 599 8 2 8 1 599 8 0 432 8 2 8 1 432 8 0 533 8 2 8 1 533 8 0 985 8 2 8 1 985 8 0 510 8 2 8 0 137 8 2 8 0 242 8 2 8 0 712 8 2 8 0 574 8 ...
result:
ok
Test #30:
score: 15
Accepted
time: 23ms
memory: 10280kb
input:
998 1 2 1 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 112 8 2 8 0 492 8 2 8 1 492 8 0 582 8 2 8 0 832 8 2 8 0 540 8 2 8 1 540 8 0 757 8 2 8 1 757 8 0 465 8 2 8 1 465 8 0 60 8 2 8 1 60 8 0 483 8 2 8 1 483 8 0 416 8 2 8 0 340 8 2 8 1 340 8 0 599 8 2 8 1 599 8 0 432 8 2 8 1 432 8 0 533 8 2 8 1 533 8 0 985 8 2 8 1 985 8 0 510 8 2 8 1 510 8 0 137 8 2 8 ...
result:
ok
Test #31:
score: 15
Accepted
time: 8ms
memory: 10044kb
input:
998 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 2 2 2 1 1 1 1 2 1 1 2 2 2 1 2 1 1 1 2 2 1 1 2 2 2 2 2 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 112 8 2 8 0 492 8 2 8 0 582 8 2 8 0 832 8 2 8 0 540 8 2 8 0 757 8 2 8 0 465 8 2 8 1 465 8 0 60 8 2 8 1 60 8 0 483 8 2 8 0 416 8 2 8 0 340 8 2 8 0 599 8 2 8 0 432 8 2 8 0 533 8 2 8 0 985 8 2 8 0 510 8 2 8 1 510 8 0 137 8 2 8 1 137 8 0 242 8 2 8 1 242 8 0 712 8 2 8 0 574 8 2 8 0 455 8 2 8 0 861 8 ...
result:
ok
Test #32:
score: 0
Wrong Answer
time: 5ms
memory: 8048kb
input:
1000 1 1 2 2 2 1 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 112 8 2 8 0 492 8 2 8 0 582 8 2 8 1 582 8 0 832 8 2 8 1 832 8 0 540 8 2 8 1 540 8 0 757 8 2 8 0 465 8 2 8 1 465 8 0 60 8 2 8 1 60 8 0 483 8 2 8 0 416 8 2 8 1 416 8 0 340 8 2 8 1 340 8 0 599 8 2 8 1 599 8 0 432 8 2 8 1 432 8 0 533 8 2 8 0 985 8 2 8 1 985 8 0 510 8 2 8 1 510 8 0 137 8 2 8 1 137 8 ...
result:
wrong answer Wrong answer.
Subtask #3:
score: 0
Wrong Answer
Test #43:
score: 75
Accepted
time: 1ms
memory: 8004kb
input:
2 1 2
output:
8 0 1 8 2 8 0 0 8 2 8 1 0 8 3 2
result:
ok
Test #44:
score: 75
Accepted
time: 2ms
memory: 10280kb
input:
2 1 1 1
output:
8 0 1 8 2 8 0 0 8 2 8 1 0 8 1 1 8 0 0 8 0 1 8 2 8 1 1 8 1 0 8 3 1
result:
ok
Test #45:
score: 75
Accepted
time: 1ms
memory: 10020kb
input:
3 1 1 2 1 1
output:
8 0 1 8 2 8 0 0 8 2 8 0 2 8 2 8 1 2 8 1 0 8 1 1 8 0 0 8 0 1 8 2 8 1 1 8 0 2 8 2 8 1 2 8 1 0 8 3 1
result:
ok
Test #46:
score: 75
Accepted
time: 2ms
memory: 10048kb
input:
6 1 2 2 2 2 1 2 3 4 5 5
output:
8 0 1 8 2 8 0 0 8 2 8 1 0 8 0 5 8 2 8 1 5 8 0 4 8 2 8 1 4 8 0 3 8 2 8 1 3 8 0 2 8 2 8 1 2 8 1 1 8 0 0 8 0 1 8 2 8 0 5 8 2 8 0 4 8 2 8 0 3 8 2 8 0 2 8 2 8 1 2 8 1 3 8 1 4 8 1 5 8 1 1 8 1 0 8 3 1
result:
ok
Test #47:
score: 75
Accepted
time: 0ms
memory: 10024kb
input:
10 1 1 2 2 2 2 2 2 2 2 1 2 3 3 3 4 4 5 6
output:
8 0 1 8 2 8 0 0 8 2 8 0 5 8 2 8 1 5 8 0 6 8 2 8 1 6 8 0 3 8 2 8 1 3 8 0 2 8 2 8 1 2 8 0 8 8 2 8 1 8 8 0 7 8 2 8 1 7 8 0 9 8 2 8 1 9 8 0 4 8 2 8 1 4 8 1 0 8 1 1 8 0 0 8 0 1 8 2 8 1 1 8 0 5 8 2 8 0 6 8 2 8 0 3 8 2 8 1 3 8 0 2 8 2 8 1 2 8 0 8 8 2 8 0 7 8 2 8 1 7 8 0 9 8 2 8 0 4 8 2 8 1 4 8 1 9 8 1 8 8 ...
result:
ok
Test #48:
score: 75
Accepted
time: 13ms
memory: 10024kb
input:
2000 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 112 8 2 8 0 492 8 2 8 1 492 8 0 1982 8 2 8 1 1982 8 0 1419 8 2 8 1 1419 8 0 1071 8 2 8 1 1071 8 0 1210 8 2 8 1 1210 8 0 465 8 2 8 1 465 8 0 1343 8 2 8 1 1343 8 0 1239 8 2 8 1 1239 8 0 1638 8 2 8 1 1638 8 0 340 8 2 8 1 340 8 0 1118 8 2 8 1 1118 8 0 432 8 2 8 1 432 8 0 1372 8 2 8 1 1372 8 0 985 8 ...
result:
ok
Test #49:
score: 75
Accepted
time: 4ms
memory: 10052kb
input:
2000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
8 0 630 8 2 8 0 1120 8 2 8 0 1648 8 2 8 0 755 8 2 8 0 694 8 2 8 0 1691 8 2 8 0 166 8 2 8 0 1259 8 2 8 0 1039 8 2 8 0 1909 8 2 8 0 91 8 2 8 0 114 8 2 8 0 1668 8 2 8 0 1719 8 2 8 0 1822 8 2 8 0 434 8 2 8 0 1215 8 2 8 0 338 8 2 8 0 1576 8 2 8 0 1987 8 2 8 0 744 8 2 8 0 217 8 2 8 0 529 8 2 8 0 1485 8 2 ...
result:
ok
Test #50:
score: 70.58
Acceptable Answer
time: 18ms
memory: 10336kb
input:
2000 1 1 2 2 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 1 2 1 1 2 1 2 1 2 1 1 2 2 2 1 1 1 2 2 2 2 2 1 2 1 1 1 2 2 2 2 2 1 2 1 1 2 1 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 2 1 2 1 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2...
output:
8 0 630 8 2 8 0 1120 8 2 8 0 1648 8 2 8 1 1648 8 0 755 8 2 8 1 755 8 0 694 8 2 8 0 1691 8 2 8 0 166 8 2 8 0 1259 8 2 8 1 1259 8 0 1039 8 2 8 0 1909 8 2 8 0 91 8 2 8 0 114 8 2 8 0 1668 8 2 8 0 1719 8 2 8 0 1822 8 2 8 1 1822 8 0 434 8 2 8 0 1215 8 2 8 0 338 8 2 8 0 1576 8 2 8 0 1987 8 2 8 0 744 8 2 8 ...
result:
points 0.94106666670 points 0.94106666670
Test #51:
score: 62.13
Acceptable Answer
time: 23ms
memory: 10016kb
input:
2000 1 1 1 1 2 2 1 1 1 1 1 1 2 2 1 2 2 2 1 1 2 1 1 1 2 1 1 2 1 2 1 2 2 1 1 2 2 1 2 2 1 2 1 2 2 2 2 2 1 1 2 1 2 2 1 2 2 2 1 2 1 1 1 2 2 1 1 1 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2...
output:
8 0 630 8 2 8 0 1120 8 2 8 0 1648 8 2 8 0 755 8 2 8 0 694 8 2 8 1 694 8 0 1691 8 2 8 1 1691 8 0 166 8 2 8 0 1259 8 2 8 0 1039 8 2 8 0 1909 8 2 8 0 91 8 2 8 0 114 8 2 8 0 1668 8 2 8 1 1668 8 0 1719 8 2 8 1 1719 8 0 1822 8 2 8 0 434 8 2 8 1 434 8 0 1215 8 2 8 1 1215 8 0 338 8 2 8 1 338 8 0 1576 8 2 8 ...
result:
points 0.82840 points 0.82840
Test #52:
score: 75
Accepted
time: 0ms
memory: 10036kb
input:
2000 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 630 8 2 8 0 1120 8 2 8 1 1120 8 0 1648 8 2 8 1 1648 8 0 755 8 2 8 1 755 8 0 694 8 2 8 1 694 8 0 1691 8 2 8 1 1691 8 0 166 8 2 8 1 166 8 0 1259 8 2 8 1 1259 8 0 1039 8 2 8 1 1039 8 0 1909 8 2 8 1 1909 8 0 91 8 2 8 1 91 8 0 114 8 2 8 1 114 8 0 1668 8 2 8 1 1668 8 0 1719 8 2 8 1 1719 8 0 1822 8 2 8...
result:
ok
Test #53:
score: 75
Accepted
time: 9ms
memory: 10004kb
input:
2000 1 1 1 1 1 1 1 2 1 1 2 2 1 2 1 1 2 1 1 2 1 1 1 2 1 2 1 1 1 2 2 2 1 2 1 1 2 2 1 1 2 1 1 2 1 2 1 2 2 1 2 2 2 2 2 1 1 1 1 1 2 1 2 2 2 2 1 2 1 1 2 1 2 2 2 1 2 2 2 2 1 1 1 1 1 2 2 1 1 2 1 2 1 1 1 2 1 2 1 2 2 2 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 2 2 1 1 2 2 2 1 1 2 1 1 2 1 2 1 1 1 1 1 2 2 2 2 2 2 1...
output:
8 0 544 8 2 8 0 621 8 2 8 0 1352 8 2 8 0 1487 8 2 8 0 1033 8 2 8 0 1604 8 2 8 0 945 8 2 8 0 754 8 2 8 1 754 8 0 1807 8 2 8 0 424 8 2 8 0 487 8 2 8 1 487 8 0 1971 8 2 8 1 1971 8 0 600 8 2 8 0 131 8 2 8 1 131 8 0 955 8 2 8 0 1809 8 2 8 0 1446 8 2 8 1 1446 8 0 1977 8 2 8 0 135 8 2 8 0 361 8 2 8 1 361 8...
result:
ok
Test #54:
score: 0
Wrong Answer
time: 12ms
memory: 10064kb
input:
2000 1 2 2 1 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 544 8 2 8 0 621 8 2 8 1 621 8 0 1352 8 2 8 1 1352 8 0 1487 8 2 8 0 1033 8 2 8 1 1033 8 0 1604 8 2 8 1 1604 8 0 945 8 2 8 1 945 8 0 754 8 2 8 0 1807 8 2 8 0 424 8 2 8 1 424 8 0 487 8 2 8 1 487 8 0 1971 8 2 8 1 1971 8 0 600 8 2 8 1 600 8 0 131 8 2 8 1 131 8 0 955 8 2 8 1 955 8 0 1809 8 2 8 1 1809 ...
result:
wrong answer Wrong answer.