QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#469672 | #8825. Puzzle: Summon | Secret Sealing Club (Fei Pan, Jialong Li, Shiyang Xiong)# | AC ✓ | 94ms | 11424kb | C++20 | 5.9kb | 2024-07-09 21:42:03 | 2024-07-09 21:42:03 |
Judging History
answer
#pragma GCC optimize(3,"Ofast","inline")
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
using namespace std;
#define ll long long
const int N=300005;
const ll mod=998244353;
ll qpow(ll a,ll b){
ll ans=1;
if(b==0)
return 1;
if(b%2)
ans=a;
ll t=qpow(a,b/2);
return t*t%mod*ans%mod;
}
ll inv(ll a){
return qpow(a,mod-2);
}
struct BN{
vector<int>a;
void resolve(){
for(int i=0;i<a.size();i++){
if(a[i]>=10){
if(i==a.size()-1){
a.push_back(a[i]/10);
}
else{
a[i+1]+=a[i]/10;
}
a[i]%=10;
}
}
}
};
struct pt{
int L;
int R;
int S1;
int S2;
int D;
};
struct sv{
BN num;
int l;
int r;
char c;
};
ll n;
sv maxx(sv &a,sv &b){
if(a.num.a.size()>b.num.a.size()){
return a;
}
else if(a.num.a.size()<b.num.a.size()){
return b;
}
else{
for(int i=a.num.a.size()-1;i>=0;i--){
if(a.num.a[i]<b.num.a[i])return b;
else if(a.num.a[i]>b.num.a[i])return a;
}
return a;
}
return a;
}
vector<sv>ans;
string str1,str2;
void rset(int id,char c){
if(c=='l'){
if(str1[2*id-2]=='1'||str2[2*id-2]=='2'){
str1[2*id-2]='1';
str2[2*id-2]='2';
}
else{
str1[2*id-2]='2';
str2[2*id-2]='1';
}
str1[2*id-1]='0';
str2[2*id-1]='0';
}
else if(c=='r'){
if(str1[2*id-1]=='1'||str2[2*id-1]=='2'){
str1[2*id-1]='1';
str2[2*id-1]='2';
}
else{
str1[2*id-1]='2';
str2[2*id-1]='1';
}
str1[2*id-2]='0';
str2[2*id-2]='0';
}
else if(c=='1'){
if(str2[2*id-2]!='?'){
str1[2*id-2]='0';
str2[2*id-2]='1';
}
else{
str1[2*id-2]='1';
str2[2*id-2]='0';
}
if(str2[2*id-1]!='?'){
str1[2*id-1]='0';
str2[2*id-1]='2';
}
else{
str1[2*id-1]='2';
str2[2*id-1]='0';
}
}
else if(c=='2'){
if(str2[2*id-2]!='?'){
str1[2*id-2]='0';
str2[2*id-2]='2';
}
else{
str1[2*id-2]='2';
str2[2*id-2]='0';
}
if(str2[2*id-1]!='?'){
str1[2*id-1]='0';
str2[2*id-1]='1';
}
else{
str1[2*id-1]='1';
str2[2*id-1]='0';
}
}
}
void check(char c,int l,int r,int ext){
BN num;
vector<int>g;
vector<int>p(2*(r-l+1)+2);
for(int i=l;i<=r;i++){
if(str2[2*i-2]!='?'){
g.push_back(3);
}
else{
if(c=='1')
g.push_back(1);
else
g.push_back(2);
}
if(str2[2*i-1]!='?'){
g.push_back(3);
}
else{
if(c=='1')
g.push_back(2);
else
g.push_back(1);
}
}
int cur=0;
for(int i=g.size()-1;i>=0;i--){
if(g[i]!=3){
p[cur]+=g[i];
cur++;
}
else{
cur=0;
}
}
p[0]+=ext;
for(int i=p.size()-1;i>=0;i--){
if(p[i]!=0){
p.resize(i+1);
break;
}
if(i==0){
p.resize(1);
}
}
num.a=p;
ans.push_back({num,l,r,c});
}
void rop(sv x){
//cout<<x.l<<' '<<x.r<<' '<<x.c<<'\n';
for(int i=x.num.a.size()-1;i>=0;i--){
cout<<x.num.a[i];
}
cout<<'\n';
if(x.c=='?'){
for(int i=1;i<=n;i++){
if(i<=x.r)
rset(i,'l');
else
rset(i,'r');
}
}
else{
for(int i=1;i<x.l;i++){
rset(i,'l');
}
for(int i=x.l;i<=x.r;i++){
rset(i,x.c);
}
for(int i=x.r+1;i<=n;i++){
rset(i,'r');
}
}
cout<<str1<<'\n';
cout<<str2<<'\n';
}
void op(int x){
if(ans.size()==0){
cout<<"impossible\n";
return;
}
for(int i=0;i<ans.size();i++){
ans[i].num.resolve();
}
sv mx=ans[0];
for(int i=1;i<ans.size();i++){
mx=maxx(ans[i],mx);
}
rop(mx);
//sort(ans.begin(),ans.end(),cmp);
}
void solve(){
cin>>n;
cin>>str1>>str2;
vector<pt>a(n+1);
ans.clear();
vector<int>sl(n+1),sr(n+1),sd(n+1);
for(int i=1;i<=n;i++){
a[i]={0,0,0,0,0};
vector<char>cur;
cur.push_back(str1[2*i-2]);
cur.push_back(str1[2*i-1]);
cur.push_back(str2[2*i-2]);
cur.push_back(str2[2*i-1]);
if(cur[0]!='?'&&cur[2]!='?'){
if(cur[1]!='?'||cur[3]!='?'){
op(0);
return ;
}
if(cur[0]==cur[2]){
op(0);
return ;
}
a[i].L=1;
a[i].D=cur[0]-'0';
}
else if(cur[1]!='?'&&cur[3]!='?'){
if(cur[0]!='?'||cur[2]!='?'){
op(0);
return ;
}
if(cur[1]==cur[3]){
op(0);
return ;
}
a[i].R=1;
a[i].D=cur[1]-'0';
}
else{
char l=min(cur[0],cur[2]);
char r=min(cur[1],cur[3]);
if(l=='?'&&r=='?'){
a[i]={1,1,1,1,2};
}
else if(l==r){
op(0);
return;
}
else if(l=='?'){
a[i].R=1;
if(r=='1'){
a[i].S2=1;
}
else if(r=='2'){
a[i].S1=1;
}
if(cur[1]=='1'||cur[3]=='2'){
a[i].D=1;
}
else{
a[i].D=2;
}
}
else if(r=='?'){
a[i].L=1;
if(l=='1'){
a[i].S1=1;
}
else if(l=='2'){
a[i].S2=1;
}
if(cur[0]=='1'||cur[2]=='2'){
a[i].D=1;
}
else{
a[i].D=2;
}
}
else{
if(l=='1')a[i].S1=1;
else a[i].S2=1;
}
}
}
sl[0]=sr[0]=sd[0]=0;
for(int i=1;i<=n;i++){
sl[i]=sl[i-1]+a[i].L;
sr[i]=sr[i-1]+a[i].R;
sd[i]=sd[i-1]+a[i].D;
}
int cur=0;
for(int i=1;i<=n;i++){
if(a[i].S1==1){
if(cur==0){
cur=i;
}
}
if(i==n||a[i+1].S1==0){
if(sl[cur-1]==cur-1&&sr[n]-sr[i]==n-i){
check('1',cur,i,sd[n]-(sd[i]-sd[cur-1]));
}
cur=0;
}
}
cur=0;
for(int i=1;i<=n;i++){
if(a[i].S2==1){
if(cur==0){
cur=i;
}
}
if(i==n||a[i+1].S2==0){
if(sl[cur-1]==cur-1&&sr[n]-sr[i]==n-i){
check('2',cur,i,sd[n]-(sd[i]-sd[cur-1]));
}
cur=0;
}
}
// for(int i=1;i<=n;i++){
// cout<<a[i].D<<' ';
// cout<<'\n';
// }
int flag=-1;
for(int i=0;i<=n;i++){
if(sl[i]==i&&sr[n]-sr[i]==n-i){
flag=i;
}
}
if(flag!=-1){
BN num;
num.a.push_back(sd[n]);
ans.push_back((sv){num,0,flag,'?'});
}
op(1);
//if('?'<'0')cout<<"QAQ";
//else cout<<"DAD";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t0;
cin>>t0;
for(int t=0;t<t0;t++){
solve();
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3824kb
input:
5 2 ?1?? ??1? 4 1??????? ???2???2 5 ?????????? ?????????? 6 1212???????? ????????1212 7 ?2?1?????1?2?? ?????1???????2
output:
impossible 242 12101210 00020002 2121212121 2121212121 0000000000 12121212 121212120000 000000001212 21 12010202010201 00020101020102
result:
ok all is correct (5 test cases)
Test #2:
score: 0
Accepted
time: 11ms
memory: 10872kb
input:
1 100000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (1 test case)
Test #3:
score: 0
Accepted
time: 11ms
memory: 10868kb
input:
1 100000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (1 test case)
Test #4:
score: 0
Accepted
time: 9ms
memory: 10964kb
input:
1 100000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (1 test case)
Test #5:
score: 0
Accepted
time: 14ms
memory: 10892kb
input:
1 100000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (1 test case)
Test #6:
score: 0
Accepted
time: 10ms
memory: 7864kb
input:
2 49999 ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (2 test cases)
Test #7:
score: 0
Accepted
time: 6ms
memory: 7808kb
input:
2 49999 ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (2 test cases)
Test #8:
score: 0
Accepted
time: 13ms
memory: 7776kb
input:
2 49999 ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (2 test cases)
Test #9:
score: 0
Accepted
time: 10ms
memory: 7876kb
input:
2 49999 ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (2 test cases)
Test #10:
score: 0
Accepted
time: 75ms
memory: 4156kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212123333333333333333333333333333333333333333333333333...
result:
ok all is correct (200 test cases)
Test #11:
score: 0
Accepted
time: 72ms
memory: 4296kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible 1212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (100 test cases)
Test #12:
score: 0
Accepted
time: 47ms
memory: 4032kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (200 test cases)
Test #13:
score: 0
Accepted
time: 45ms
memory: 4092kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (100 test cases)
Test #14:
score: 0
Accepted
time: 36ms
memory: 3684kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible 212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (200 test cases)
Test #15:
score: 0
Accepted
time: 45ms
memory: 3968kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible 212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (100 test cases)
Test #16:
score: 0
Accepted
time: 77ms
memory: 3892kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (200 test cases)
Test #17:
score: 0
Accepted
time: 84ms
memory: 4116kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (100 test cases)
Test #18:
score: 0
Accepted
time: 43ms
memory: 3904kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (200 test cases)
Test #19:
score: 0
Accepted
time: 51ms
memory: 3964kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible 2121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (100 test cases)
Test #20:
score: 0
Accepted
time: 46ms
memory: 3852kb
input:
200 5000 ???2???????????????????????????????????????1???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible 121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (200 test cases)
Test #21:
score: 0
Accepted
time: 42ms
memory: 4012kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (100 test cases)
Test #22:
score: 0
Accepted
time: 74ms
memory: 4048kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (200 test cases)
Test #23:
score: 0
Accepted
time: 79ms
memory: 4452kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (100 test cases)
Test #24:
score: 0
Accepted
time: 51ms
memory: 3748kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (200 test cases)
Test #25:
score: 0
Accepted
time: 51ms
memory: 4164kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (100 test cases)
Test #26:
score: 0
Accepted
time: 43ms
memory: 3940kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible 2121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (200 test cases)
Test #27:
score: 0
Accepted
time: 47ms
memory: 3964kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible 121212121212121212121212121212121212121212121214242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424...
result:
ok all is correct (100 test cases)
Test #28:
score: 0
Accepted
time: 72ms
memory: 3932kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (200 test cases)
Test #29:
score: 0
Accepted
time: 73ms
memory: 4184kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (100 test cases)
Test #30:
score: 0
Accepted
time: 50ms
memory: 3896kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible 121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121213333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333...
result:
ok all is correct (200 test cases)
Test #31:
score: 0
Accepted
time: 52ms
memory: 3968kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible 1212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (100 test cases)
Test #32:
score: 0
Accepted
time: 47ms
memory: 4092kb
input:
200 5000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible 212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (200 test cases)
Test #33:
score: 0
Accepted
time: 40ms
memory: 3944kb
input:
100 10000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (100 test cases)
Test #34:
score: 0
Accepted
time: 56ms
memory: 7148kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (20 test cases)
Test #35:
score: 0
Accepted
time: 65ms
memory: 10000kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (10 test cases)
Test #36:
score: 0
Accepted
time: 48ms
memory: 6372kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (20 test cases)
Test #37:
score: 0
Accepted
time: 51ms
memory: 11004kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible 1212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (10 test cases)
Test #38:
score: 0
Accepted
time: 47ms
memory: 6148kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible 2121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (20 test cases)
Test #39:
score: 0
Accepted
time: 39ms
memory: 7032kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible
result:
ok all is correct (10 test cases)
Test #40:
score: 0
Accepted
time: 76ms
memory: 6608kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (20 test cases)
Test #41:
score: 0
Accepted
time: 79ms
memory: 10304kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (10 test cases)
Test #42:
score: 0
Accepted
time: 52ms
memory: 6608kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (20 test cases)
Test #43:
score: 0
Accepted
time: 50ms
memory: 10220kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible 2121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (10 test cases)
Test #44:
score: 0
Accepted
time: 48ms
memory: 6288kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (20 test cases)
Test #45:
score: 0
Accepted
time: 45ms
memory: 9504kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible 212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (10 test cases)
Test #46:
score: 0
Accepted
time: 77ms
memory: 7080kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (20 test cases)
Test #47:
score: 0
Accepted
time: 75ms
memory: 11424kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible 1212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (10 test cases)
Test #48:
score: 0
Accepted
time: 47ms
memory: 7108kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (20 test cases)
Test #49:
score: 0
Accepted
time: 50ms
memory: 10096kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (10 test cases)
Test #50:
score: 0
Accepted
time: 52ms
memory: 6708kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (20 test cases)
Test #51:
score: 0
Accepted
time: 41ms
memory: 6900kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible
result:
ok all is correct (10 test cases)
Test #52:
score: 0
Accepted
time: 73ms
memory: 7348kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...
result:
ok all is correct (20 test cases)
Test #53:
score: 0
Accepted
time: 84ms
memory: 10512kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (10 test cases)
Test #54:
score: 0
Accepted
time: 46ms
memory: 6312kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible 121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (20 test cases)
Test #55:
score: 0
Accepted
time: 56ms
memory: 9980kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (10 test cases)
Test #56:
score: 0
Accepted
time: 45ms
memory: 6444kb
input:
20 50000 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (20 test cases)
Test #57:
score: 0
Accepted
time: 43ms
memory: 7044kb
input:
10 100000 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
impossible impossible 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...
result:
ok all is correct (10 test cases)
Test #58:
score: 0
Accepted
time: 41ms
memory: 3852kb
input:
100000 1 ?? 2? 1 ?? 12 1 1? 2? 1 1? ?? 1 1? 1? 1 1? 2? 1 ?2 ?1 1 ?1 ?? 1 1? ?? 1 ?? ?1 1 ?? 12 1 ?? 21 1 ?? 2? 1 1? ?? 1 1? ?? 1 ?1 ?2 1 2? 2? 1 ?? ?1 1 21 ?? 1 ?? ?1 1 2? 1? 1 ?2 ?? 1 2? 2? 1 2? 2? 1 ?? ?1 1 1? ?? 1 ?2 ?2 1 2? ?1 1 2? 1? 1 2? 1? 1 2? 1? 1 ?? 2? 1 ?? 12 1 1? ?2 1 ?? ?1 1 2? ?1 1 ?? ...
output:
1 10 20 0 00 12 1 10 20 12 12 00 impossible 1 10 20 2 02 01 21 21 00 12 12 00 2 02 01 0 00 12 0 00 21 1 10 20 12 12 00 12 12 00 1 01 02 impossible 2 02 01 21 21 00 2 02 01 2 20 10 12 12 00 impossible impossible 2 02 01 12 12 00 impossible 2 20 01 2 20 10 2 20 10 2 20 10 1 10 20 0 00 12 1 10 02 2 02 ...
result:
ok all is correct (100000 test cases)
Test #59:
score: 0
Accepted
time: 86ms
memory: 3872kb
input:
20000 50 ?????????????????????????2?????????????????????????????????????????????????????????????????????????? ?????2?????????????????????????????????????????????????????????????????????????????????????????????? 50 ?????????????????????????????2??????2?????????????????????????????????????????????????...
output:
1212121212121212121212121212121212121212121212121212121212121212121212121212121212121212133333 1212101212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212 0000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 imp...
result:
ok all is correct (20000 test cases)
Test #60:
score: 0
Accepted
time: 26ms
memory: 3552kb
input:
100000 1 2? 2? 1 ?2 ?2 1 21 ?? 1 21 21 1 2? 2? 1 21 21 1 ?1 ?1 1 ?2 ?2 1 ?2 ?2 1 2? 2? 1 ?1 ?1 1 12 12 1 1? ?? 1 ?1 ?1 1 ?1 ?1 1 12 ?2 1 ?2 ?2 1 1? 2? 1 1? 2? 1 12 12 1 ?2 ?2 1 2? 1? 1 12 ?2 1 1? 2? 1 ?2 ?2 1 21 2? 1 ?1 ?1 1 2? 1? 1 2? 21 1 ?2 ?2 1 ?2 ?1 1 12 1? 1 ?1 ?1 1 12 12 1 12 12 1 1? 1? 1 ?2 ...
output:
impossible impossible 21 21 00 impossible impossible impossible impossible impossible impossible impossible impossible impossible 12 12 00 impossible impossible impossible impossible 1 10 20 1 10 20 impossible impossible 2 20 10 impossible 1 10 20 impossible impossible impossible 2 20 10 impossible ...
result:
ok all is correct (100000 test cases)
Test #61:
score: 0
Accepted
time: 60ms
memory: 3856kb
input:
20000 50 ???????????????????????1??????????????????????????????1????????????????????????????????????????????? ???????????????????????????????1??????????????2???????????????????????1???????????????1????????????? 50 ?????????1?????????????????????????1???1??????????????????????????????????????????????...
output:
impossible impossible impossible impossible impossible 21212121212121212196 2020202020202020202020102020202020202020201020202020202020201020202020202020102121212121212121212101 1010101010101010101010201010101010101010102010101010101010102010101010101010200000000000000000000020 impossible 21212121308...
result:
ok all is correct (20000 test cases)
Test #62:
score: 0
Accepted
time: 24ms
memory: 3632kb
input:
100000 1 21 21 1 12 12 1 2? 1? 1 1? 2? 1 21 21 1 12 12 1 12 1? 1 1? 2? 1 21 21 1 2? 21 1 ?2 ?2 1 ?2 ?2 1 12 12 1 12 12 1 21 21 1 2? 1? 1 21 21 1 2? 2? 1 2? 2? 1 2? 1? 1 1? 1? 1 ?1 ?2 1 21 21 1 ?2 ?2 1 ?1 ?1 1 12 12 1 21 21 1 2? 2? 1 21 21 1 21 21 1 2? 1? 1 1? 1? 1 1? 2? 1 21 ?1 1 ?2 ?2 1 21 21 1 ?1 ...
output:
impossible impossible 2 20 10 1 10 20 impossible impossible impossible 1 10 20 impossible impossible impossible impossible impossible impossible impossible 2 20 10 impossible impossible impossible 2 20 10 impossible 1 01 02 impossible impossible impossible impossible impossible impossible impossible...
result:
ok all is correct (100000 test cases)
Test #63:
score: 0
Accepted
time: 42ms
memory: 3564kb
input:
20000 50 ???????1???????????????????2?2???????????????2?????????????1????????????????????????2??????????????? ???????????????????????????2?????????????????????????1?????????????1??????2???????????????1????????? 50 ?????????????????????????????????1?????????????????2???1????1?????????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible 21212121212201 212121212121210101020...
result:
ok all is correct (20000 test cases)
Test #64:
score: 0
Accepted
time: 41ms
memory: 3552kb
input:
100000 1 ?2 1? 1 2? ?1 1 ?1 ?1 1 2? ?? 1 ?2 ?1 1 ?? 21 1 ?1 2? 1 ?? 2? 1 2? ?1 1 ?2 ?? 1 21 ?? 1 ?? 2? 1 ?? 21 1 ?? 21 1 1? ?2 1 21 ?? 1 2? 1? 1 21 ?? 1 ?2 ?1 1 2? ?? 1 ?? 21 1 ?1 ?2 1 ?? 2? 1 2? ?? 1 21 ?? 1 1? ?? 1 ?2 ?? 1 ?? ?2 1 ?1 2? 1 ?2 1? 1 ?2 ?2 1 ?1 ?1 1 ?? 21 1 2? ?? 1 1? 2? 1 1? 1? 1 1? ...
output:
2 02 10 2 20 01 impossible 21 21 00 2 02 01 0 00 21 1 01 20 1 10 20 2 20 01 12 12 00 21 21 00 1 10 20 0 00 21 0 00 21 1 10 02 21 21 00 2 20 10 21 21 00 2 02 01 21 21 00 0 00 21 1 01 02 1 10 20 21 21 00 21 21 00 12 12 00 12 12 00 1 01 02 1 01 20 2 02 10 impossible impossible 0 00 21 21 21 00 1 10 20 ...
result:
ok all is correct (100000 test cases)
Test #65:
score: 0
Accepted
time: 82ms
memory: 3596kb
input:
20000 50 ???????????????????????????????????????????????????????????????????????????????????????????????????? ???????????1???????????????????????????????????????????????????????????????????????????2???????????? 50 ?????????????????2????????????????????????????????????????????????????????????????????...
output:
21212121212121212121212121212121212121212121212121212121212121233333333346 2121212121202121212121212121212121212121212121212121212121212121212121212121212121212101020202020202 0000000000010000000000000000000000000000000000000000000000000000000000000000000000000002010101010101 21212121212121212121212...
result:
ok all is correct (20000 test cases)
Test #66:
score: 0
Accepted
time: 26ms
memory: 3852kb
input:
100000 1 2? 2? 1 21 2? 1 2? 1? 1 12 ?? 1 1? 2? 1 2? 1? 1 ?1 ?1 1 ?2 12 1 ?2 ?2 1 21 21 1 21 21 1 21 2? 1 ?2 ?1 1 2? 2? 1 12 12 1 2? 2? 1 2? 21 1 21 ?1 1 ?2 ?2 1 2? 1? 1 ?1 ?1 1 21 21 1 ?2 ?2 1 12 12 1 1? 12 1 21 ?1 1 ?2 ?1 1 ?2 12 1 ?1 21 1 21 ?1 1 ?1 ?2 1 2? 2? 1 2? 2? 1 21 ?1 1 ?1 ?1 1 21 21 1 21 ...
output:
impossible impossible 2 20 10 12 12 00 1 10 20 2 20 10 impossible impossible impossible impossible impossible impossible 2 02 01 impossible impossible impossible impossible impossible impossible 2 20 10 impossible impossible impossible impossible impossible impossible 2 02 01 impossible impossible i...
result:
ok all is correct (100000 test cases)
Test #67:
score: 0
Accepted
time: 60ms
memory: 3628kb
input:
20000 50 ?????????2????????????????????????????????????????????????????????2?????????1??????????????????????? ??????????????????????????????1?2???????????????????????????????????????????????1??????????????????? 50 ?????????????????????????????????1????????????????????????????2???2???????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible 233 2020202020202020202020102020202020202020202020202020202020201020202020202020202020202020202010210121 1010101010101010101010201010101010101010101010101010101010102010101010101010101010101010101020002000 impossible 212121...
result:
ok all is correct (20000 test cases)
Test #68:
score: 0
Accepted
time: 24ms
memory: 3556kb
input:
100000 1 ?2 ?2 1 2? 2? 1 12 12 1 21 21 1 21 21 1 ?2 ?1 1 ?1 ?2 1 1? 12 1 ?1 ?2 1 12 12 1 1? 2? 1 ?1 ?2 1 21 21 1 ?1 ?1 1 21 21 1 12 12 1 2? 1? 1 ?2 ?1 1 ?1 ?1 1 1? 12 1 ?1 ?2 1 12 12 1 ?2 ?2 1 1? 2? 1 ?2 ?2 1 21 21 1 21 21 1 12 12 1 21 21 1 21 21 1 ?1 ?2 1 21 21 1 21 21 1 21 21 1 1? 2? 1 21 21 1 21 ...
output:
impossible impossible impossible impossible impossible 2 02 01 1 01 02 impossible 1 01 02 impossible 1 10 20 1 01 02 impossible impossible impossible impossible 2 20 10 2 02 01 impossible impossible 1 01 02 impossible impossible 1 10 20 impossible impossible impossible impossible impossible impossib...
result:
ok all is correct (100000 test cases)
Test #69:
score: 0
Accepted
time: 49ms
memory: 3580kb
input:
20000 50 ????????????1??????????????????????????????????22?????????????1???????????????????????????????2????? 1???????1????????????????????2?2??????????????????????????1???????????????2???????????2????????????? 50 ???????2?????????????????????2?????????????1????????????????????????????????????????1?...
output:
impossible impossible impossible impossible 1226363636421 2020202010202010202020102020202020201020102020202020202020201020212121212101212121212121012121212121 1010101020101020101010201010101010102010201010101010101010102010000000000020000000000000200000000000 impossible 12121212121213333333333333545...
result:
ok all is correct (20000 test cases)
Test #70:
score: 0
Accepted
time: 41ms
memory: 3552kb
input:
100000 1 ?1 ?1 1 1? 1? 1 2? 1? 1 ?? ?2 1 ?1 ?2 1 ?1 ?? 1 ?2 ?? 1 1? ?? 1 2? 2? 1 1? ?? 1 2? ?? 1 ?2 ?1 1 2? ?1 1 2? 2? 1 ?? 2? 1 2? 2? 1 ?2 ?2 1 2? ?? 1 ?? 2? 1 ?1 2? 1 2? ?1 1 ?? ?1 1 2? ?1 1 ?? 21 1 1? 1? 1 2? 2? 1 1? ?? 1 2? 2? 1 ?? 1? 1 ?2 ?? 1 2? 2? 1 1? 1? 1 ?1 ?1 1 ?2 ?2 1 ?? ?2 1 ?2 ?2 1 2? ...
output:
impossible impossible 2 20 10 1 01 02 1 01 02 21 21 00 12 12 00 12 12 00 impossible 12 12 00 21 21 00 2 02 01 2 20 01 impossible 1 10 20 impossible impossible 21 21 00 1 10 20 1 01 20 2 20 01 2 02 01 2 20 01 0 00 21 impossible impossible 12 12 00 impossible 2 20 10 12 12 00 impossible impossible imp...
result:
ok all is correct (100000 test cases)
Test #71:
score: 0
Accepted
time: 94ms
memory: 3796kb
input:
20000 50 ??????????????????????????????????????????????????????????????????????1????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????2??? 50 ??????????????????????????????????????????????????????????????????????????????????????...
output:
212121212121212121212313 2020202020202020202020202020202020202020202020202020202020202020202020102121212121212121212121210121 1010101010101010101010101010101010101010101010101010101010101010101010200000000000000000000000002000 12121212121212121212121213345454545454545454545454 1212121212121212121212...
result:
ok all is correct (20000 test cases)
Test #72:
score: 0
Accepted
time: 26ms
memory: 3616kb
input:
100000 1 ?1 ?1 1 2? 21 1 1? 2? 1 ?1 ?2 1 ?1 ?2 1 21 21 1 21 ?1 1 1? 1? 1 12 ?? 1 2? 21 1 21 2? 1 1? 1? 1 1? 2? 1 ?2 12 1 ?2 ?2 1 1? 2? 1 2? 2? 1 12 12 1 ?1 ?2 1 1? 12 1 ?2 ?1 1 ?1 ?2 1 1? 2? 1 ?2 ?1 1 ?1 ?1 1 1? 1? 1 1? ?2 1 1? 1? 1 1? 2? 1 21 21 1 ?2 ?2 1 21 21 1 ?2 ?1 1 21 2? 1 2? 1? 1 ?2 ?2 1 1? ...
output:
impossible impossible 1 10 20 1 01 02 1 01 02 impossible impossible impossible 12 12 00 impossible impossible impossible 1 10 20 impossible impossible 1 10 20 impossible impossible 1 01 02 impossible 2 02 01 1 01 02 1 10 20 2 02 01 impossible impossible 1 10 02 impossible 1 10 20 impossible impossib...
result:
ok all is correct (100000 test cases)
Test #73:
score: 0
Accepted
time: 61ms
memory: 3524kb
input:
20000 50 ?????????2???2???????2??????????????????????????????????????????????2???????2??????????????????????? ????????????????????????????????????????????????????????????????????????????????1??????????????????? 50 ?????????2?????????????????1??????????????????????????????????????????????????????????...
output:
impossible impossible 214242424242424242500 2121212121212121212021212121212121212121202102020201020202020202020202020202020202020202020202020202 0000000000000000000100000000000000000000010001010102010101010101010101010101010101010101010101010101 impossible 2121212121295 21212121212120010202020202020...
result:
ok all is correct (20000 test cases)
Test #74:
score: 0
Accepted
time: 24ms
memory: 3544kb
input:
100000 1 12 ?2 1 ?1 ?1 1 12 12 1 ?2 ?2 1 21 21 1 2? 1? 1 21 21 1 21 21 1 21 21 1 2? 1? 1 ?2 ?1 1 21 21 1 21 21 1 21 21 1 2? 1? 1 ?1 ?2 1 21 21 1 12 12 1 21 21 1 2? 2? 1 21 21 1 12 12 1 ?1 ?1 1 2? 1? 1 12 12 1 2? 2? 1 21 21 1 12 1? 1 12 12 1 ?2 12 1 12 12 1 2? 2? 1 21 21 1 ?2 ?2 1 12 12 1 ?1 ?1 1 ?2 ...
output:
impossible impossible impossible impossible impossible 2 20 10 impossible impossible impossible 2 20 10 2 02 01 impossible impossible impossible 2 20 10 1 01 02 impossible impossible impossible impossible impossible impossible impossible 2 20 10 impossible impossible impossible impossible impossible...
result:
ok all is correct (100000 test cases)
Test #75:
score: 0
Accepted
time: 48ms
memory: 3844kb
input:
20000 50 ???1???1????????????????2?????????????????????2?????????????????2?????????????????????????????1????? ????????????????2?????????????????????????????????2????????????????1????2??????????????????????????? 50 ???????????????????????1????????????????2???????????????????????????????????????1?????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible 2121212121212142426363636363670 2020202020202020101020202020202020200212121212121202121212121212121212121212121212021212121212121212 10101010101010102020101010101010101010000000000000100000000000000000...
result:
ok all is correct (20000 test cases)
Test #76:
score: 0
Accepted
time: 41ms
memory: 3804kb
input:
100000 1 2? 2? 1 2? ?? 1 ?? ?2 1 2? ?1 1 2? 1? 1 ?? 2? 1 21 ?? 1 ?1 ?2 1 2? 2? 1 2? ?1 1 1? 1? 1 1? 1? 1 ?? 12 1 1? 2? 1 2? 1? 1 ?2 ?2 1 1? ?2 1 1? ?2 1 ?1 ?? 1 2? 2? 1 1? ?2 1 1? ?2 1 2? ?? 1 2? 1? 1 12 ?? 1 ?2 ?2 1 ?2 1? 1 ?? 1? 1 12 ?? 1 1? 1? 1 ?? 21 1 ?1 ?2 1 2? 1? 1 ?? 1? 1 ?? ?1 1 1? ?2 1 ?1 ...
output:
impossible 21 21 00 1 01 02 2 20 01 2 20 10 1 10 20 21 21 00 1 01 02 impossible 2 20 01 impossible impossible 0 00 12 1 10 20 2 20 10 impossible 1 10 02 1 10 02 21 21 00 impossible 1 10 02 1 10 02 21 21 00 2 20 10 12 12 00 impossible 2 02 10 2 20 10 12 12 00 impossible 0 00 21 1 01 02 2 20 10 2 20 1...
result:
ok all is correct (100000 test cases)
Test #77:
score: 0
Accepted
time: 85ms
memory: 3864kb
input:
20000 50 ????????????????????????????????????????????????????????????1???????????????????1??????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????? 50 ??????????????????????????????????????????????????????????????????????????????????????...
output:
1212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212 1212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok all is correct (20000 test cases)
Test #78:
score: 0
Accepted
time: 26ms
memory: 3608kb
input:
100000 1 ?1 ?2 1 21 21 1 ?2 ?2 1 2? 2? 1 1? 2? 1 21 ?1 1 ?1 ?1 1 21 2? 1 12 12 1 1? 2? 1 ?2 ?2 1 21 21 1 ?2 ?1 1 1? 1? 1 ?2 1? 1 ?2 12 1 12 1? 1 1? 1? 1 2? 1? 1 12 1? 1 12 12 1 2? 2? 1 21 ?1 1 21 ?1 1 1? 1? 1 ?2 12 1 2? 1? 1 ?1 ?1 1 1? 2? 1 ?1 21 1 ?1 ?2 1 ?2 ?1 1 2? 1? 1 12 12 1 2? 1? 1 12 1? 1 ?2 ...
output:
1 01 02 impossible impossible impossible 1 10 20 impossible impossible impossible impossible 1 10 20 impossible impossible 2 02 01 impossible 2 02 10 impossible impossible impossible 2 20 10 impossible impossible impossible impossible impossible impossible impossible 2 20 10 impossible 1 10 20 impos...
result:
ok all is correct (100000 test cases)
Test #79:
score: 0
Accepted
time: 59ms
memory: 3560kb
input:
20000 50 ???1?????2???????????????????????????????????????????2????????????????????????????????????????2????? ?????????1????????????????????????????????????????????????????????????2????????????????????????????? 50 ???????????????????1??????????????????????????????????????????????????????????????????...
output:
impossible impossible 1212121212121224263659699092120 2121212121202121212121212101212021212120212121212101212121212121212101212121212121212121212121212121 0000000000010000000000000020000100000001000000000020000000000000000020000000000000000000000000000000 impossible 1214242424242424242424293 2020202...
result:
ok all is correct (20000 test cases)
Test #80:
score: 0
Accepted
time: 25ms
memory: 3576kb
input:
100000 1 2? 2? 1 21 21 1 2? 2? 1 2? 1? 1 21 21 1 1? 1? 1 21 21 1 ?1 ?1 1 21 21 1 ?1 ?2 1 2? 1? 1 2? 1? 1 ?1 ?1 1 21 21 1 2? 1? 1 1? 1? 1 2? 1? 1 21 21 1 21 ?1 1 12 12 1 12 12 1 12 12 1 21 21 1 1? 1? 1 12 12 1 2? 1? 1 2? 2? 1 21 21 1 2? 2? 1 ?1 ?2 1 21 21 1 1? 12 1 2? 2? 1 ?2 ?2 1 21 21 1 12 12 1 21 ...
output:
impossible impossible impossible 2 20 10 impossible impossible impossible impossible impossible 1 01 02 2 20 10 2 20 10 impossible impossible 2 20 10 impossible 2 20 10 impossible impossible impossible impossible impossible impossible impossible impossible 2 20 10 impossible impossible impossible 1 ...
result:
ok all is correct (100000 test cases)
Test #81:
score: 0
Accepted
time: 44ms
memory: 3528kb
input:
20000 50 ?1???????1????????????????????2?????????????????????????????????????2??????????????????????????????? ?2?????????????1???1????????????????????????????????????????????????1???2?????????????1???????1????? 50 ???????????????????????2??????????????????2???????2??????????????1????????????????????...
output:
impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible 2121212242424365758909112...
result:
ok all is correct (20000 test cases)
Extra Test:
score: 0
Extra Test Passed