QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#538018 | #4565. Rarest Insects | Yahia_Emara# | 0 | 18ms | 10256kb | C++20 | 3.0kb | 2024-08-30 20:54:46 | 2024-08-30 20:54:48 |
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<=6){
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: 0ms
memory: 9988kb
input:
6 1 2 1 2 1 2 1 1 2 2 2 1 1 1 1
output:
8 0 2 8 2 8 0 4 8 2 8 1 4 8 0 3 8 2 8 0 0 8 2 8 1 0 8 0 1 8 2 8 0 5 8 2 8 1 5 8 1 1 8 1 3 8 1 2 8 0 3 8 0 2 8 2 8 1 2 8 0 4 8 2 8 1 4 8 0 0 8 2 8 0 1 8 2 8 1 1 8 0 5 8 2 8 1 5 8 1 0 8 1 3 8 0 0 8 0 2 8 2 8 1 2 8 0 4 8 2 8 1 4 8 0 1 8 2 8 1 1 8 0 5 8 2 8 1 5 8 1 0 8 3 1
result:
ok
Test #2:
score: 10
Accepted
time: 0ms
memory: 10016kb
input:
2 1 2
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 3 2
result:
ok
Test #3:
score: 10
Accepted
time: 0ms
memory: 7936kb
input:
2 1 1 1
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 1 0 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: 1ms
memory: 10068kb
input:
3 1 2 1 2 2
output:
8 0 2 8 2 8 0 1 8 2 8 1 1 8 0 0 8 2 8 1 0 8 1 2 8 0 2 8 0 1 8 2 8 0 0 8 2 8 1 0 8 1 1 8 1 2 8 3 1
result:
ok
Test #5:
score: 10
Accepted
time: 1ms
memory: 7892kb
input:
5 1 1 2 2 2 2 2 2 2
output:
8 0 2 8 2 8 0 4 8 2 8 0 3 8 2 8 1 3 8 0 0 8 2 8 1 0 8 0 1 8 2 8 1 1 8 1 4 8 1 2 8 0 1 8 0 2 8 2 8 0 4 8 2 8 1 4 8 0 3 8 2 8 1 3 8 0 0 8 2 8 1 0 8 1 2 8 1 1 8 3 2
result:
ok
Test #6:
score: 10
Accepted
time: 1ms
memory: 10008kb
input:
8 1 2 2 1 1 2 2 2 2 3 4 4 4 5 5 2 2
output:
8 0 2 8 2 8 0 4 8 2 8 1 4 8 0 3 8 2 8 1 3 8 0 6 8 2 8 0 7 8 2 8 0 5 8 2 8 1 5 8 0 0 8 2 8 1 0 8 0 1 8 2 8 1 1 8 1 7 8 1 6 8 1 2 8 0 1 8 0 2 8 2 8 0 4 8 2 8 0 3 8 2 8 0 6 8 2 8 1 6 8 0 7 8 2 8 1 7 8 0 5 8 2 8 0 0 8 2 8 1 0 8 1 5 8 1 3 8 1 4 8 1 2 8 1 1 8 0 0 8 0 6 8 2 8 0 7 8 2 8 1 7 8 1 6 8 1 0 8 3 1
result:
ok
Test #7:
score: 10
Accepted
time: 0ms
memory: 10076kb
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 29 8 2 8 0 74 8 2 8 1 74 8 0 89 8 2 8 1 89 8 0 188 8 2 8 1 188 8 0 7 8 2 8 1 7 8 0 156 8 2 8 1 156 8 0 170 8 2 8 1 170 8 0 195 8 2 8 1 195 8 0 43 8 2 8 1 43 8 0 190 8 2 8 1 190 8 0 30 8 2 8 1 30 8 0 98 8 2 8 1 98 8 0 121 8 2 8 1 121 8 0 49 8 2 8 1 49 8 0 97 8 2 8 1 97 8 0 63 8 2 8 1 63 8 0 166 8...
result:
ok
Test #8:
score: 10
Accepted
time: 3ms
memory: 10008kb
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 29 8 2 8 0 74 8 2 8 0 89 8 2 8 0 188 8 2 8 0 7 8 2 8 0 156 8 2 8 0 170 8 2 8 0 195 8 2 8 0 43 8 2 8 0 190 8 2 8 0 30 8 2 8 0 98 8 2 8 0 121 8 2 8 0 49 8 2 8 0 97 8 2 8 0 63 8 2 8 0 166 8 2 8 0 191 8 2 8 0 174 8 2 8 0 161 8 2 8 0 134 8 2 8 0 154 8 2 8 0 113 8 2 8 0 55 8 2 8 0 131 8 2 8 0 15 8 2 8...
result:
ok
Test #9:
score: 10
Accepted
time: 5ms
memory: 10236kb
input:
200 1 1 1 2 2 1 1 2 1 2 2 1 1 1 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 1 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 ...
output:
8 0 29 8 2 8 0 74 8 2 8 0 89 8 2 8 0 188 8 2 8 1 188 8 0 7 8 2 8 1 7 8 0 156 8 2 8 0 170 8 2 8 0 195 8 2 8 1 195 8 0 43 8 2 8 0 190 8 2 8 1 190 8 0 30 8 2 8 1 30 8 0 98 8 2 8 0 121 8 2 8 0 49 8 2 8 0 97 8 2 8 0 63 8 2 8 0 166 8 2 8 1 166 8 0 191 8 2 8 1 191 8 0 174 8 2 8 1 174 8 0 161 8 2 8 1 161 8 ...
result:
ok
Test #10:
score: 10
Accepted
time: 0ms
memory: 10244kb
input:
198 1 1 1 1 2 2 1 1 1 2 2 1 2 1 2 2 2 1 2 2 2 1 2 2 2 2 2 2 1 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 ...
output:
8 0 29 8 2 8 0 74 8 2 8 0 89 8 2 8 0 188 8 2 8 0 7 8 2 8 1 7 8 0 156 8 2 8 1 156 8 0 170 8 2 8 0 195 8 2 8 0 43 8 2 8 0 190 8 2 8 1 190 8 0 30 8 2 8 1 30 8 0 98 8 2 8 0 121 8 2 8 1 121 8 0 49 8 2 8 0 97 8 2 8 1 97 8 0 63 8 2 8 1 63 8 0 166 8 2 8 1 166 8 0 191 8 2 8 0 174 8 2 8 1 174 8 0 161 8 2 8 1 ...
result:
ok
Test #11:
score: 10
Accepted
time: 3ms
memory: 8020kb
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 29 8 2 8 0 74 8 2 8 1 74 8 0 89 8 2 8 1 89 8 0 188 8 2 8 1 188 8 0 7 8 2 8 1 7 8 0 156 8 2 8 1 156 8 0 170 8 2 8 1 170 8 0 195 8 2 8 1 195 8 0 43 8 2 8 1 43 8 0 190 8 2 8 1 190 8 0 30 8 2 8 1 30 8 0 98 8 2 8 1 98 8 0 121 8 2 8 1 121 8 0 49 8 2 8 1 49 8 0 97 8 2 8 1 97 8 0 63 8 2 8 1 63 8 0 166 8...
result:
ok
Test #12:
score: 10
Accepted
time: 0ms
memory: 10076kb
input:
197 1 1 2 1 1 1 1 1 1 2 1 1 1 2 2 1 2 2 1 2 1 1 2 2 2 2 1 2 1 1 2 1 1 2 2 1 2 2 2 1 2 1 2 2 2 1 1 2 1 2 1 1 1 1 2 2 1 2 2 2 2 1 1 1 1 2 1 2 2 2 2 1 1 1 2 2 2 1 1 2 1 2 1 2 1 1 2 2 1 1 1 2 2 2 2 2 1 1 1 1 2 1 1 2 2 1 1 2 2 2 2 2 1 1 2 2 1 1 1 2 1 1 2 1 2 2 1 1 2 2 1 1 1 2 2 2 1 1 2 2 2 1 2 2 2 2 1 2 ...
output:
8 0 29 8 2 8 0 74 8 2 8 0 89 8 2 8 1 89 8 0 188 8 2 8 0 7 8 2 8 0 156 8 2 8 0 170 8 2 8 0 195 8 2 8 0 43 8 2 8 0 190 8 2 8 1 190 8 0 30 8 2 8 0 98 8 2 8 0 121 8 2 8 0 49 8 2 8 1 49 8 0 97 8 2 8 1 97 8 0 63 8 2 8 0 166 8 2 8 1 166 8 0 191 8 2 8 1 191 8 0 174 8 2 8 0 161 8 2 8 1 161 8 0 134 8 2 8 0 15...
result:
ok
Test #13:
score: 0
Wrong Answer
time: 2ms
memory: 9992kb
input:
197 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 2 2 2 2 2 2 2 2 2 2 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 ...
output:
8 0 29 8 2 8 0 74 8 2 8 1 74 8 0 89 8 2 8 0 188 8 2 8 0 7 8 2 8 1 7 8 0 156 8 2 8 1 156 8 0 170 8 2 8 1 170 8 0 195 8 2 8 0 43 8 2 8 1 43 8 0 190 8 2 8 1 190 8 0 30 8 2 8 1 30 8 0 98 8 2 8 1 98 8 0 121 8 2 8 1 121 8 0 49 8 2 8 1 49 8 0 97 8 2 8 1 97 8 0 63 8 2 8 1 63 8 0 166 8 2 8 1 166 8 0 191 8 2 ...
result:
wrong answer Wrong answer.
Subtask #2:
score: 0
Wrong Answer
Test #24:
score: 15
Accepted
time: 3ms
memory: 9988kb
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 364 8 2 8 0 235 8 2 8 1 235 8 0 628 8 2 8 1 628 8 0 729 8 2 8 1 729 8 0 329 8 2 8 1 329 8 0 685 8 2 8 1 685 8 0 311 8 2 8 1 311 8 0 834 8 2 8 1 834 8 0 930 8 2 8 1 930 8 0 789 8 2 8 1 789 8 0 546 8 2 8 1 546 8 0 98 8 2 8 1 98 8 0 827 8 2 8 1 827 8 0 562 8 2 8 1 562 8 0 614 8 2 8 1 614 8 0 451 8 ...
result:
ok
Test #25:
score: 15
Accepted
time: 6ms
memory: 10000kb
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 364 8 2 8 0 235 8 2 8 0 628 8 2 8 0 729 8 2 8 0 329 8 2 8 0 685 8 2 8 0 311 8 2 8 0 834 8 2 8 0 930 8 2 8 0 789 8 2 8 0 546 8 2 8 0 98 8 2 8 0 827 8 2 8 0 562 8 2 8 0 614 8 2 8 0 451 8 2 8 0 207 8 2 8 0 496 8 2 8 0 516 8 2 8 0 974 8 2 8 0 906 8 2 8 0 876 8 2 8 0 781 8 2 8 0 626 8 2 8 0 131 8 2 8...
result:
ok
Test #26:
score: 15
Accepted
time: 6ms
memory: 10256kb
input:
999 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 1 1 2 1 2 2 1 1 2 1 1 2 2 1 1 2 1 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 1 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 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 ...
output:
8 0 364 8 2 8 0 235 8 2 8 0 628 8 2 8 0 729 8 2 8 0 329 8 2 8 0 685 8 2 8 1 685 8 0 311 8 2 8 0 834 8 2 8 0 930 8 2 8 0 789 8 2 8 0 546 8 2 8 1 546 8 0 98 8 2 8 0 827 8 2 8 0 562 8 2 8 0 614 8 2 8 1 614 8 0 451 8 2 8 0 207 8 2 8 0 496 8 2 8 0 516 8 2 8 0 974 8 2 8 1 974 8 0 906 8 2 8 0 876 8 2 8 1 8...
result:
ok
Test #27:
score: 15
Accepted
time: 4ms
memory: 10016kb
input:
999 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 1 1 2 1 2 1 2 1 2 1 2 2 1 2 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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 ...
output:
8 0 364 8 2 8 0 235 8 2 8 0 628 8 2 8 0 729 8 2 8 0 329 8 2 8 0 685 8 2 8 0 311 8 2 8 0 834 8 2 8 0 930 8 2 8 0 789 8 2 8 0 546 8 2 8 1 546 8 0 98 8 2 8 0 827 8 2 8 0 562 8 2 8 0 614 8 2 8 0 451 8 2 8 0 207 8 2 8 0 496 8 2 8 1 496 8 0 516 8 2 8 1 516 8 0 974 8 2 8 1 974 8 0 906 8 2 8 1 906 8 0 876 8...
result:
ok
Test #28:
score: 15
Accepted
time: 6ms
memory: 10004kb
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 364 8 2 8 0 235 8 2 8 1 235 8 0 628 8 2 8 1 628 8 0 729 8 2 8 1 729 8 0 329 8 2 8 1 329 8 0 685 8 2 8 1 685 8 0 311 8 2 8 1 311 8 0 834 8 2 8 1 834 8 0 930 8 2 8 1 930 8 0 789 8 2 8 1 789 8 0 546 8 2 8 1 546 8 0 98 8 2 8 1 98 8 0 827 8 2 8 1 827 8 0 562 8 2 8 1 562 8 0 614 8 2 8 1 614 8 0 451 8 ...
result:
ok
Test #29:
score: 15
Accepted
time: 0ms
memory: 9996kb
input:
995 1 1 2 2 2 1 1 2 1 1 2 1 2 2 2 2 2 2 2 1 2 2 1 2 2 2 1 2 1 2 1 1 1 1 2 2 1 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 1 1 2 2 1 1 1 2 1 2 2 1 1 2 2 2 2 2 1 1 2 2 1 1 2 1 2 1 2 1 1 2 1 1 2 1 2 1 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 1 2 2 1 2 2 1 1 1 2 2 2 2 1 2 1 1 1 2 2 1 1 2 1 1 1 2 1 1 1 1 2 1 2 1 1 2 2 1 2 1 2 2 ...
output:
8 0 364 8 2 8 0 235 8 2 8 0 628 8 2 8 1 628 8 0 729 8 2 8 1 729 8 0 329 8 2 8 1 329 8 0 685 8 2 8 0 311 8 2 8 0 834 8 2 8 1 834 8 0 930 8 2 8 0 789 8 2 8 0 546 8 2 8 1 546 8 0 98 8 2 8 0 827 8 2 8 1 827 8 0 562 8 2 8 1 562 8 0 614 8 2 8 1 614 8 0 451 8 2 8 1 451 8 0 207 8 2 8 1 207 8 0 496 8 2 8 1 4...
result:
ok
Test #30:
score: 0
Wrong Answer
time: 8ms
memory: 9992kb
input:
998 1 1 2 1 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 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 ...
output:
8 0 551 8 2 8 0 824 8 2 8 0 756 8 2 8 1 756 8 0 18 8 2 8 0 992 8 2 8 1 992 8 0 591 8 2 8 0 857 8 2 8 1 857 8 0 766 8 2 8 1 766 8 0 733 8 2 8 1 733 8 0 791 8 2 8 1 791 8 0 124 8 2 8 1 124 8 0 224 8 2 8 1 224 8 0 623 8 2 8 1 623 8 0 907 8 2 8 1 907 8 0 29 8 2 8 1 29 8 0 890 8 2 8 1 890 8 0 589 8 2 8 1...
result:
wrong answer Wrong answer.
Subtask #3:
score: 0
Wrong Answer
Test #43:
score: 75
Accepted
time: 1ms
memory: 7964kb
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: 1ms
memory: 9988kb
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: 9984kb
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 #46:
score: 75
Accepted
time: 0ms
memory: 9984kb
input:
6 1 1 2 2 2 2 2 2 3 4 5
output:
8 0 4 8 2 8 0 2 8 2 8 0 5 8 2 8 1 5 8 0 0 8 2 8 1 0 8 0 1 8 2 8 1 1 8 0 3 8 2 8 1 3 8 1 2 8 1 4 8 0 5 8 0 4 8 2 8 0 2 8 2 8 1 2 8 0 0 8 2 8 0 1 8 2 8 0 3 8 2 8 1 3 8 1 1 8 1 0 8 1 4 8 1 5 8 3 1
result:
ok
Test #47:
score: 75
Accepted
time: 1ms
memory: 9984kb
input:
10 1 2 1 2 2 2 2 2 2 2 2 3 3 4 4 4 4 5 6
output:
8 0 4 8 2 8 0 6 8 2 8 1 6 8 0 7 8 2 8 0 0 8 2 8 1 0 8 0 1 8 2 8 1 1 8 0 3 8 2 8 1 3 8 0 2 8 2 8 1 2 8 0 9 8 2 8 1 9 8 0 8 8 2 8 1 8 8 0 5 8 2 8 1 5 8 1 7 8 1 4 8 0 9 8 0 4 8 2 8 0 6 8 2 8 0 7 8 2 8 1 7 8 0 0 8 2 8 0 1 8 2 8 1 1 8 0 3 8 2 8 1 3 8 0 2 8 2 8 1 2 8 0 8 8 2 8 0 5 8 2 8 1 5 8 1 8 8 1 0 8 ...
result:
ok
Test #48:
score: 75
Accepted
time: 2ms
memory: 10228kb
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 1147 8 2 8 0 824 8 2 8 1 824 8 0 756 8 2 8 1 756 8 0 18 8 2 8 1 18 8 0 1523 8 2 8 1 1523 8 0 1967 8 2 8 1 1967 8 0 857 8 2 8 1 857 8 0 766 8 2 8 1 766 8 0 1209 8 2 8 1 1209 8 0 1665 8 2 8 1 1665 8 0 1999 8 2 8 1 1999 8 0 224 8 2 8 1 224 8 0 623 8 2 8 1 623 8 0 907 8 2 8 1 907 8 0 29 8 2 8 1 29 8...
result:
ok
Test #49:
score: 75
Accepted
time: 0ms
memory: 10104kb
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 1147 8 2 8 0 824 8 2 8 0 756 8 2 8 0 18 8 2 8 0 1523 8 2 8 0 1967 8 2 8 0 857 8 2 8 0 766 8 2 8 0 1209 8 2 8 0 1665 8 2 8 0 1999 8 2 8 0 224 8 2 8 0 623 8 2 8 0 907 8 2 8 0 29 8 2 8 0 1048 8 2 8 0 1511 8 2 8 0 1709 8 2 8 0 1127 8 2 8 0 163 8 2 8 0 1033 8 2 8 0 67 8 2 8 0 1469 8 2 8 0 447 8 2 8 0...
result:
ok
Test #50:
score: 70.57
Acceptable Answer
time: 6ms
memory: 10032kb
input:
2000 1 1 1 1 1 2 1 1 1 1 1 1 2 1 2 1 1 2 2 1 2 1 1 2 1 2 1 2 2 1 2 2 1 1 1 1 1 1 2 2 2 1 1 2 1 2 2 2 1 2 2 1 2 2 1 1 2 1 2 2 2 2 2 2 2 2 1 2 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 1 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...
output:
8 0 1147 8 2 8 0 824 8 2 8 0 756 8 2 8 0 18 8 2 8 0 1523 8 2 8 0 1967 8 2 8 1 1967 8 0 857 8 2 8 0 766 8 2 8 0 1209 8 2 8 0 1665 8 2 8 0 1999 8 2 8 0 224 8 2 8 0 623 8 2 8 1 623 8 0 907 8 2 8 0 29 8 2 8 1 29 8 0 1048 8 2 8 0 1511 8 2 8 0 1709 8 2 8 1 1709 8 0 1127 8 2 8 1 1127 8 0 163 8 2 8 0 1033 8...
result:
points 0.94093333330 points 0.94093333330
Test #51:
score: 62.08
Acceptable Answer
time: 18ms
memory: 10244kb
input:
2000 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 2 2 1 1 2 1 1 2 1 1 1 2 1 1 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 1 2 2 1 2 1 1 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 1 2 2 1 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 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...
output:
8 0 1147 8 2 8 0 824 8 2 8 0 756 8 2 8 0 18 8 2 8 0 1523 8 2 8 0 1967 8 2 8 0 857 8 2 8 0 766 8 2 8 0 1209 8 2 8 0 1665 8 2 8 0 1999 8 2 8 0 224 8 2 8 0 623 8 2 8 0 907 8 2 8 1 907 8 0 29 8 2 8 1 29 8 0 1048 8 2 8 0 1511 8 2 8 0 1709 8 2 8 1 1709 8 0 1127 8 2 8 1 1127 8 0 163 8 2 8 0 1033 8 2 8 0 67...
result:
points 0.82773333330 points 0.82773333330
Test #52:
score: 75
Accepted
time: 7ms
memory: 10040kb
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 1529 8 2 8 0 1812 8 2 8 1 1812 8 0 1997 8 2 8 1 1997 8 0 855 8 2 8 1 855 8 0 1651 8 2 8 1 1651 8 0 512 8 2 8 1 512 8 0 1569 8 2 8 1 1569 8 0 929 8 2 8 1 929 8 0 1104 8 2 8 1 1104 8 0 1369 8 2 8 1 1369 8 0 1394 8 2 8 1 1394 8 0 1700 8 2 8 1 1700 8 0 85 8 2 8 1 85 8 0 1860 8 2 8 1 1860 8 0 65 8 2 ...
result:
ok
Test #53:
score: 75
Accepted
time: 8ms
memory: 8240kb
input:
2000 1 2 1 2 2 2 2 1 2 2 2 1 2 2 2 1 2 1 1 1 1 2 2 1 2 1 2 2 2 2 1 1 1 2 2 1 1 2 2 2 1 2 1 2 2 1 2 2 1 2 2 1 2 2 1 1 1 2 2 2 1 2 1 1 2 1 1 1 2 1 1 2 1 2 1 2 2 1 2 2 1 2 2 2 2 1 1 2 1 2 1 2 2 2 1 2 1 2 1 1 2 1 2 1 2 1 1 2 2 2 2 2 2 2 2 1 1 2 1 1 1 2 2 1 2 1 2 2 1 1 2 2 2 1 2 1 1 1 2 2 2 1 1 2 2 2 2 1...
output:
8 0 1529 8 2 8 0 1812 8 2 8 1 1812 8 0 1997 8 2 8 0 855 8 2 8 1 855 8 0 1651 8 2 8 1 1651 8 0 512 8 2 8 1 512 8 0 1569 8 2 8 1 1569 8 0 929 8 2 8 0 1104 8 2 8 1 1104 8 0 1369 8 2 8 1 1369 8 0 1394 8 2 8 1 1394 8 0 1700 8 2 8 0 85 8 2 8 1 85 8 0 1860 8 2 8 1 1860 8 0 65 8 2 8 1 65 8 0 471 8 2 8 0 141...
result:
ok
Test #54:
score: 0
Wrong Answer
time: 5ms
memory: 7972kb
input:
2000 1 1 1 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 2 2 2 2 2...
output:
8 0 1529 8 2 8 0 1812 8 2 8 0 1997 8 2 8 0 855 8 2 8 1 855 8 0 1651 8 2 8 0 512 8 2 8 1 512 8 0 1569 8 2 8 1 1569 8 0 929 8 2 8 1 929 8 0 1104 8 2 8 1 1104 8 0 1369 8 2 8 1 1369 8 0 1394 8 2 8 1 1394 8 0 1700 8 2 8 1 1700 8 0 85 8 2 8 1 85 8 0 1860 8 2 8 1 1860 8 0 65 8 2 8 1 65 8 0 471 8 2 8 1 471 ...
result:
wrong answer Wrong answer.