QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#885474 | #9768. A + B = C Problem | Zpair | WA | 1ms | 3840kb | C++17 | 1.3kb | 2025-02-06 15:48:38 | 2025-02-06 15:48:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int lcm(int x,int y){
return x/__gcd(x,y)*y;
}
void p0(int x=1){while(x--)printf("0");}
void p1(int x=1){while(x--)printf("1");}
void pn(){printf("\n");}
void solve(){
int pa,pb,pc;
scanf("%d%d%d",&pa,&pb,&pc);
if(pa==2&&pb==2&&pc==2)return puts("NO"),void();
if(lcm(pb,pc)%pa!=0||lcm(pa,pc)%pb!=0||lcm(pb,pc)%pa!=0)
return puts("NO"),void();
puts("YES");
int g=__gcd(__gcd(pa,pb),pc);
pa/=g,pb/=g,pc/=g;
int p=__gcd(pa,pb);
int q=__gcd(pa,pc);
int r=__gcd(pb,pc);
if(p==1&&q==1&&r==1){
assert(g!=2);
if(g==1){
p0(),pn();
p0(),pn();
p0(),pn();
}
else{
p0(g-2),p0(),p1(),pn();
p0(g-2),p1(),p0(),pn();
p0(g-2),p1(),p1(),pn();
}
return;
}
if(p==1&&q==1&&r>1){
p0(g-1),p1(),pn();
p0(g*r-1),p1(),pn();
for(int i=0;i<g*q*r;++i){
int c0=(i%g==0);
int c1=(i%(g*r)==0);
printf("%d",c0^c1);
}
pn();
return;
}
for(int i=0;i<g*p*q;++i){
int P=(i/g)%p,Q=(i/g)%q;
printf("%d",(P%p==0)^(Q%q==0));
}
pn();
for(int i=0;i<g*p*r;++i){
int P=(i/g)%p,R=(i/g)%r;
printf("%d",(P%p==0)^(R%r==0));
}
pn();
for(int i=0;i<g*q*r;++i){
int Q=(i/g)%q,R=(i/g)%r;
printf("%d",(Q%q==0)^(R%r==0));
}
pn();
}
//gpq gpr gqr
int main(){
int T;cin>>T;
while(T--)solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3840kb
input:
2 2 3 6 2 3 5
output:
YES 01 011 001110 NO
result:
ok ok (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3840kb
input:
1214 940 746 485 304 504 661 815 674 830 704 774 691 545 597 924 330 894 320 491 425 479 768 869 698 706 480 785 358 548 504 999 473 363 532 950 745 512 682 364 829 832 959 570 931 317 324 543 362 590 421 737 326 483 503 958 890 793 836 721 518 720 361 363 730 402 753 810 416 585 781 953 490 623 360...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 00000011100011100011100011100011100011100011100011100011100011100011100011100011100011100011100011100011100011100011100011100011100...
result:
wrong answer Invalid output! (test case 56)