QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#286556 | #7979. 棋盘 | Crysfly | 100 ✓ | 365ms | 5692kb | C++17 | 9.1kb | 2023-12-18 00:56:00 | 2023-12-18 00:56:00 |
Judging History
answer
// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define mod 998244353
struct modint{
int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,int b){return a.x==b;}
friend bool operator !=(modint a,int b){return a.x!=b;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#ifndef __x86_64__
#error Only x86-64 targets are supported
#endif
#define __builtin_ia32_adc(x,y,flag) __asm__("addb %3, %0\n\t" "adcq %2, %1\n\t" "setc %0":"+r"(flag),"+r"(x):"r"(y),"i"(-1):"cc")
struct bigint{// made by dengyaotriangle!
typedef unsigned long long u64;
typedef unsigned __int128 u128;
typedef std::size_t st;
std::vector<u64> data;
bigint(){}
bigint(u64 x):data(x?std::vector<u64>{x}:std::vector<u64>{}){}
bigint(const std::string &s){
st pos=s.length();
int cnt=0;
u64 val=0;
while(pos){
pos--;
if(cnt==64){
data.push_back(val);
val=0;cnt=0;
}
val|=(u64)(s[pos]=='1')<<cnt;
++cnt;
}
if(cnt&&val)data.push_back(val);
}
explicit operator std::string()const{
if(data.empty())return "0";
bool t=0;
std::string ret;
for(int i=63;i>=0;i--){
t|=(data.back()>>i)&1;
if(t)ret+='0'|((data.back()>>i)&1);
}
st i=data.size()-1;
while(i){
i--;
for(int j=63;j>=0;j--)ret+='0'|((data[i]>>j)&1);
}
return ret;
}
explicit operator bool()const{return !data.empty();}
explicit operator u64()const{return data.empty()?0:data[0];}
st digit()const{
if(data.empty())return 0;
return (data.size()<<6)-__builtin_clzll(data.back());
}
bool operator==(const bigint &a)const{return a.data==data;}
bool operator!=(const bigint &a)const{return a.data!=data;}
bool operator<(const bigint &a)const{
if(data.size()!=a.data.size())return data.size()<a.data.size();
for(st i=data.size();i;){
i--;
if(data[i]!=a.data[i])return data[i]<a.data[i];
}
return 0;
}
bool operator>(const bigint &a)const{return a<(*this);}
bool operator<=(const bigint &a)const{return !(*this>a);}
bool operator>=(const bigint &a)const{return !(*this<a);}
bigint &operator<<=(st n){
if(data.empty())return *this;
int w=n&63;st z=n>>6;
st i=data.size();
bool flg=0;
if(w&&(data.back()>>(64-w)))data.push_back(0),flg=1;
data.resize(data.size()+z);
while(i){
i--;
if(flg)data[i+z+1]|=data[i]>>(64-w);
data[i+z]=data[i]<<w;
flg|=bool(w);
}
for(st i=0;i<z;i++)data[i]=0;
return *this;
}
bigint &operator>>=(st n){
int w=n&63;st z=n>>6,i=0;
for(;i+z<data.size();i++){
if(w&&i)data[i-1]|=data[i+z]<<(64-w);
data[i]=data[i+z]>>w;
}
while(data.size()>i)data.pop_back();
while(!data.empty()&&data.back()==0)data.pop_back();
return *this;
}
bigint operator<<(st n)const{return bigint(*this)<<=n;}
bigint operator>>(st n)const{return bigint(*this)>>=n;}
bigint &operator+=(const bigint &a){
data.resize(std::max(data.size(),a.data.size()));
bool carry=0;
for(st i=0;i<data.size();i++){
u64 rg=0;
if(i<a.data.size())rg=a.data[i];
__builtin_ia32_adc(data[i],rg,carry);
}
if(carry)data.push_back(1);
return *this;
}
bigint &operator-=(const bigint &a){
bool carry=1;
for(st i=0;i<data.size();i++){
u64 rg=-1;
if(i<a.data.size())rg=~a.data[i];
__builtin_ia32_adc(data[i],rg,carry);
}
while(!data.empty()&&data.back()==0)data.pop_back();
return *this;
}
bigint &operator++(){return *this+=bigint(1);}
bigint &operator--(){return *this-=bigint(1);}
bigint operator++(int){bigint tmp=*this;++*this;return tmp;}
bigint operator--(int){bigint tmp=*this;--*this;return tmp;}
bigint &operator*=(const bigint &a){
std::vector<u64> ret(data.size()+a.data.size());
for(st i=0;i<data.size();i++){
u64 carry=0;bool wcarry=0;
st k=i;
for(st j=0;j<a.data.size();j++,k++){
u128 r=data[i]*(u128)a.data[j]+carry;
u64 cur=r;
carry=r>>64;
__builtin_ia32_adc(ret[k],cur,wcarry);
}
while(carry||wcarry){
__builtin_ia32_adc(ret[k],carry,wcarry);
carry=0;k++;
}
}
while(!ret.empty()&&ret.back()==0)ret.pop_back();
data=ret;
return *this;
}
bigint &operator/=(const bigint &a){
if(a.digit()>digit()){
data.clear();
return *this;
}
st z=digit()-a.digit();
std::vector<u64> ret;
while(1){
bigint tmp=a<<z;
if(tmp<=*this){
*this-=tmp;
st v1=z>>6;
if(ret.size()<=v1)ret.resize(v1+1);
ret[v1]|=(u64)(1)<<(z&63);
}
if(!z)break;
z--;
}
data=ret;
return *this;
}
bigint &operator%=(const bigint &a){
if(a.digit()>digit())return *this;
st z=digit()-a.digit();
while(1){
bigint tmp=a<<z;
if(tmp<=*this)*this-=tmp;
if(!z)break;
z--;
}
return *this;
}
bigint operator+(const bigint &a)const{return bigint(*this)+=a;}
bigint operator-(const bigint &a)const{return bigint(*this)-=a;}
bigint operator*(const bigint &a)const{return bigint(*this)*=a;}
bigint operator/(const bigint &a)const{return bigint(*this)/=a;}
bigint operator%(const bigint &a)const{return bigint(*this)%=a;}
};
std::istream &operator>>(std::istream &st,bigint &a){
std::string s;st>>s;a=bigint(s);return st;
}
std::ostream &operator<<(std::ostream &st,const bigint &a){
return st<<(std::string)(a);
}
#define maxn 200005
#define inf 0x3f3f3f3f
int k,Q,X,Y;
bigint fib[500];
bigint pw[11][105];
bool vis[maxn];
pii p[maxn]; int m;
int id[maxn];
signed main()
{
For(i,1,9){
pw[i][0]=i;
For(j,1,100)pw[i][j]=pw[i][j-1]*10;
}
k=read(),Q=read(),X=read(),Y=read();
fib[0]=fib[1]=1;
fib[2]=2;
For(i,3,480) fib[i]=fib[i-1]+fib[i-2];
// For(i,470,480){
// if(fib[i]>pw[1][100])cout<<"ok "<<i<<"\n";
// }
p[++m]=mkp(1,1),p[++m]=mkp(1,2),p[++m]=mkp(2,1),p[++m]=mkp(2,2);
id[1]=3,id[2]=4;
int now=2;
For(i,2,240){
p[++m]=mkp(now,now+1);
p[++m]=mkp(now+1,now-1);
p[++m]=mkp(now+1,now);
p[++m]=mkp(now+1,now+1);
++now;
id[i*2-1]=m-1;
id[i*2]=m;
}
cout<<m<<"\n";
For(i,1,m)cout<<p[i].fi<<" "<<p[i].se<<"\n";
while(Q--){
string s;cin>>s;
int sz=s.size();
bigint x=0;
For(i,0,sz-1) if(s[i]!='0') x=x+pw[s[i]-'0'][sz-1-i];
Rep(i,480,0)
if(x>=fib[i]){
x-=fib[i];
vis[id[i]]=1;
}
For(i,1,m)cout<<vis[i],vis[i]=0;
cout<<"\n";
}
return 0;
}
/*
*/
详细
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 27ms
memory: 3700kb
input:
3 999 1000 340 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Subtask #2:
score: 10
Accepted
Test #2:
score: 10
Accepted
time: 286ms
memory: 3716kb
input:
12 10000 1000 340 358908473750 36343501002 904324605639 453955046266 725478753662 218319365131 882878650993 648345848966 474401697383 722377018680 718743783955 748051292505 167886140898 411111004914 327825244967 990026144963 623309580364 970889332700 319445927842 527624602835 453135227321 1153226125...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #3:
score: 0
Accepted
time: 284ms
memory: 3928kb
input:
12 10000 1000 340 930556110177 377904923573 36236934395 488122716493 51121341209 392176146788 323693311937 449196823461 336471392319 92713238333 281418059653 761936598942 293730650349 106748001462 609643804851 703543108800 999258707162 376689099489 435462123411 710775118008 45582546742 835557591196 ...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #4:
score: 0
Accepted
time: 289ms
memory: 3708kb
input:
12 10000 1000 340 737930395319 182266797635 731674395027 268811900200 40636281734 385606961047 579973266668 244481758021 889308913416 116731076438 760018797175 690646649762 295657481984 860132997501 798927396859 973501342055 371555705903 89078273643 755892420101 664745115837 527923357928 12789900388...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Subtask #3:
score: 10
Accepted
Test #5:
score: 10
Accepted
time: 354ms
memory: 3644kb
input:
100 10000 1000 340 87490023455826213450979333037504606824522062808297739018786336978222089712660133428564103979384831 874900289913204769749000879539227331559680630241808944569515663934025397982898503777823815274323967 8749002899116133353924895735921513229471979456689635148877567298640178774668643967...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #6:
score: 0
Accepted
time: 350ms
memory: 3640kb
input:
100 10000 1000 340 8748936149282545611299720421204578485624739530690115026507467181657344327662766924981916612956258303 8714827106557313136171687656546075434718184787427526246530142735325290665843132579235229445895749631 8749002377650837755861570823748389228611868494396845969260163830921683752297192...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Subtask #4:
score: 10
Accepted
Test #7:
score: 10
Accepted
time: 347ms
memory: 3704kb
input:
100 10000 990 310 4083451712318559926139496762164571032902328806667934236880329773320213539959944736095945843081512968 7811890641057562314768022152641517082686481268288006737090208624016586608183953908313798353213188661 97358161226180890688421784730819518002666166790210320310558753031161862165361257...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #8:
score: 0
Accepted
time: 348ms
memory: 3896kb
input:
100 10000 990 310 536242740270410789572341652869398338093269589584059146826540461135298742334471009085914940446278287 4201975342869797382342066007535560618192359692007374881623572540610172361008282611340412383037024069 963134484370112575147508066354646119797740257454037562403391582920830075099761880...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Subtask #5:
score: 10
Accepted
Test #9:
score: 10
Accepted
time: 352ms
memory: 3740kb
input:
100 10000 1050 260 8749002899132047697490008908470485461412677723566863434996575047286849703722697797645542008396185599 8749002899132047697490008908470485461412677699052921091826559946707718798046219210886366418022957055 7655377536740541735303757766642121742076255665128332760334129720709510994307378...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #10:
score: 0
Accepted
time: 350ms
memory: 3896kb
input:
100 10000 1050 260 8749002899132047697490008908470485461412677723572849745703082425639811996797503692892926808185372671 874900289913204769701566661490981966686019183484759731181812123183820701469425350909196577361887231 87490028991280691115987306153332424033768113943575511927837611721527450026923859...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Subtask #6:
score: 10
Accepted
Test #11:
score: 10
Accepted
time: 361ms
memory: 3740kb
input:
100 10000 1050 240 8749002899132047697490008908470485461412677723572849734285100881333676956761384191490477496469520383 874886939179415873527191365288672777702448917037688119492655525651250910013304087281579324577152991 87490028991320476974900089084704854614126777235728490149522637601883528949454159...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #12:
score: 0
Accepted
time: 365ms
memory: 3644kb
input:
100 10000 1050 240 8748869399942302640609859219613849864404711585518072959767189754493152526763381301362784876544131071 8749002898113529709322765865336262617207988643047115548870114300321741770881768540817196765514039295 8749002899132047697490008908470485448242213512826165447361161116479336307579296...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Subtask #7:
score: 20
Accepted
Test #13:
score: 20
Accepted
time: 1ms
memory: 3596kb
input:
100 1 980 260 8749002899132047697490008908470485461309833682610292204604841418296589481615503153703163411103219711
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #14:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
100 1 980 260 26140399507039494187363454808469075954177491358550589658445256177636481188801043146566104810349008
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #15:
score: 0
Accepted
time: 1ms
memory: 5692kb
input:
100 1 980 260 2916334299201423571746379638671656065302994540964775389402649871877310689655011516150737480170427669
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #16:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
100 1 980 260 133733063818254349335501779590031438654517135520213587361323145147457390997763303065570586431533875
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #17:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
100 1 980 260 9216845717656874712980450562726202415567360565980794777111390850331644813674856981646960226192287360
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #18:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
100 1 980 260 5264952002436106359851318041422054633517706683530105573021775026464088057584242164048188378737906836
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Subtask #8:
score: 25
Accepted
Test #19:
score: 25
Accepted
time: 357ms
memory: 3648kb
input:
100 10000 960 240 8749002899132047697015724510954438324957730968977252383122989921226002617013223698533483281626692607 8749002899132047697490008908470485461412677720507858663971304708923117942496885325656574463725010943 87148271065573131361716885470369961093519598137825155235803895087505468828694702...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct
Test #20:
score: 0
Accepted
time: 358ms
memory: 3888kb
input:
100 10000 960 240 87490028991320476974751875210481089883984606374917376934978638676026103357677379577201035900354559 874900289913204769748997996044817613236382183082659757372611910814364558665649382849850729809805311 87490028979301854287209922417527640508689863212316623120229713820718860216280007473...
output:
960 1 1 1 2 2 1 2 2 2 3 3 1 3 2 3 3 3 4 4 2 4 3 4 4 4 5 5 3 5 4 5 5 5 6 6 4 6 5 6 6 6 7 7 5 7 6 7 7 7 8 8 6 8 7 8 8 8 9 9 7 9 8 9 9 9 10 10 8 10 9 10 10 10 11 11 9 11 10 11 11 11 12 12 10 12 11 12 12 12 13 13 11 13 12 13 13 13 14 14 12 14 13 14 14 14 15 15 13 15 14 15 15 15 16 16 14 16 15 16 16 16 1...
result:
ok correct