QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#842401 | #1845. Permute | hicgnliaw | AC ✓ | 171ms | 3964kb | C++14 | 3.4kb | 2025-01-04 12:27:47 | 2025-01-04 12:27:49 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int rc[6] = {1,3,2,6,4,5};
int T,rcnt[10],cnt[7],kd,apn[7],spn[7],sc,akd;
ll sum;
int f(ll p){
return rc[p%6];
}
void getv(int x,int c = -1){
if(c>=0){
int dl = min(c,rcnt[x]);
// printf("%d %d!\n",c,dl);
printf("%d %d\n",dl,x);
c-=dl;
rcnt[x]-=dl;
x+=7;
printf("%d %d\n",c,(x<10?x:0));
if(x<10)rcnt[x]-=c;
return;
}
if(rcnt[x])rcnt[x]--,spn[sc++] = x;
else rcnt[x+7]--,spn[sc++] = x+7;
if(!rcnt[spn[sc-1]])akd--;
}
int pt(){
int r = 0;
for(int i = 0;i<10;i++){
if(rcnt[i]){
printf("%d %d\n",rcnt[i],i);
r+=(f(sum)-f(sum-rcnt[i]))*i;
sum-=rcnt[i];
}
}
return (r*4%7+7)%7;
}
void bl(){
sort(spn,spn+sc);
printf("%d\n",sc+akd);
int nr,r = pt();
// printf("%d\n",r);
do{
nr = 0;
for(int i = 0;i<sc;i++)nr = (nr*3+spn[i])%7;
if((nr+r)%7==0)break;
}while(next_permutation(spn,spn+sc));
if((nr+r)%7)exit(int('?'));
for(int i = 0;i<sc;i++)printf("1 %d\n",spn[i]);
}
int main(){
scanf("%d",&T);
while(T--){
memset(cnt,0,sizeof(cnt));
sum = akd = 0;
for(int i = 0;i<10;i++){
scanf("%d",&rcnt[i]);
if(rcnt[i])akd++;
cnt[i%7]+=rcnt[i];
sum+=rcnt[i];
}
kd = 0;
for(int i = 0;i<7;i++)if(cnt[i])apn[kd++] = i;
sc = 0;
if(kd>=4){
for(int i = 0;i<4;i++)getv(apn[i]);
bl();
}else if(kd==3){
int co = 0;
for(int i:{0,1,2})if(cnt[apn[i]]==1)co++;
if(co<=1){
for(int i:{1,2})if(cnt[apn[i]]==1)swap(apn[i],apn[0]);
getv(apn[0]);
for(int i:{1,2}){
for(int ct:{1,2})getv(apn[i]);
}
bl();
}else{
// printf("?");
// for(int i = 0;i<10;i++)printf("%d ",rcnt[i]);
// printf("\n");
for(int i:{0,1})if(cnt[apn[i]]!=1)swap(apn[i],apn[2]);
int r = (f(sum)-1)*apn[2]*4%7,cr = min((int)sum,12),d[2] = {apn[0]-apn[2],apn[1]-apn[2]};
bool fg = 0;
for(int i = 0;i<cr;i++){
for(int j = 0;j<cr;j++){
if(i==j)continue;
if(((r+f(i)*d[0]+f(j)*d[1])%7+7)%7==0){
printf("10\n");
getv(apn[2],sum-max(i,j)-1);
if(i>j)getv(apn[0],1);
else getv(apn[1],1);
getv(apn[2],abs(i-j)-1);
if(i<j)getv(apn[0],1);
else getv(apn[1],1);
getv(apn[2],min(i,j));
fg = 1;
break;
}
}
if(fg)break;
}
if(!fg)printf("-1\n");
}
}else if(kd==2){
if(sum<=5){
for(int i = 0;i<10;i++){
while(rcnt[i]--)spn[sc++] = i;
}
int nr;
do{
nr = 0;
for(int i = 0;i<sc;i++)nr = (nr*3+spn[i])%7;
if(!nr)break;
}while(next_permutation(spn,spn+sc));
if(nr){
printf("-1\n");
}else{
printf("%lld\n",sum);
for(int i = 0;i<sum;i++)printf("1 %d\n",spn[i]);
}
}else{
if(cnt[apn[0]]>cnt[apn[1]])swap(apn[0],apn[1]);
if(cnt[apn[0]]>1){
// printf("!");
for(int ct:{0,1})getv(apn[0]);
for(int ct:{0,1,2})getv(apn[1]);
bl();
}else{
int r = (f(sum)-1)*4*apn[1]%7;
bool fg = 0;
for(int i = 0;i<6;i++){
if((f(i)*(apn[0]-apn[1]+7)+r)%7==0){
printf("6\n");
getv(apn[1],sum-i-1);
getv(apn[0],1);
getv(apn[1],i);
fg = 1;
break;
}
}
if(!fg)printf("-1\n");
}
}
}else{
if(apn[0]&&sum%6)printf("-1\n");
else{
printf("2\n");
getv(apn[0],sum);
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3912kb
input:
3 0 1 0 0 1 0 0 0 0 0 0 2 0 0 0 0 1 0 0 1 0 1000000000 0 0 0 0 0 0 0 0
output:
2 1 1 1 4 10 2 1 0 8 1 6 0 0 0 1 0 8 0 2 1 9 0 1 0 8 -1
result:
ok T=3
Test #2:
score: 0
Accepted
time: 100ms
memory: 3908kb
input:
100000 0 0 0 1 0 1 1 1 0 1 1 1 0 0 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 1 0 1 0 1 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1...
output:
5 1 6 1 5 1 7 1 9 1 3 5 1 8 1 0 1 1 1 6 1 4 6 1 7 1 9 1 0 1 1 1 3 1 2 6 1 6 1 8 1 1 1 2 1 7 1 5 4 1 6 1 4 1 8 1 2 -1 10 1 1 1 8 0 2 1 9 0 1 0 8 1 0 0 7 0 1 0 8 5 1 6 1 2 1 0 1 3 1 4 5 1 9 1 2 1 7 1 1 1 5 -1 6 1 6 1 8 1 1 1 0 1 9 1 3 -1 8 1 4 1 5 1 6 1 9 1 1 1 7 1 2 1 3 -1 4 1 6 1 4 1 8 1 9 7 1 6 1 7...
result:
ok T=100000
Test #3:
score: 0
Accepted
time: 125ms
memory: 3876kb
input:
100000 2 1 2 1 0 1 1 0 2 0 1 2 0 1 1 2 1 1 2 1 2 2 2 1 0 2 1 1 2 2 1 1 0 2 0 2 0 1 2 0 1 0 2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 9 1 0 1 ...
result:
ok T=100000
Test #8:
score: 0
Accepted
time: 134ms
memory: 3852kb
input:
100000 0 1 3 6 5 0 5 1 1 4 2 3 7 4 3 2 2 3 7 7 6 4 5 6 7 0 1 7 0 1 1 6 1 2 5 2 5 6 0 2 6 3 0 4 4 5 4 0 4 1 6 4 7 4 3 0 3 5 3 7 0 4 0 0 7 0 3 1 2 4 1 2 6 2 1 0 3 1 2 5 7 3 7 4 1 6 1 3 1 5 7 1 6 4 6 5 2 2 1 5 4 1 7 3 0 3 4 1 3 6 7 5 3 3 1 6 3 5 5 1 2 5 5 7 1 2 5 6 1 6 0 0 7 2 0 0 4 7 1 1 0 5 4 1 7 1 1...
output:
10 2 2 5 3 5 4 5 6 1 8 4 9 1 1 1 2 1 3 1 7 14 1 0 2 1 6 2 3 3 3 4 2 5 2 6 3 7 7 8 7 9 1 0 1 2 1 3 1 1 12 5 0 3 1 4 2 5 3 7 4 1 6 7 7 1 9 1 0 1 2 1 3 1 1 11 5 1 1 3 5 4 2 5 5 6 6 7 2 9 1 1 1 2 1 3 1 0 11 5 0 2 1 3 3 4 4 5 5 4 6 4 8 1 0 1 1 1 3 1 9 13 5 0 3 1 6 2 3 3 3 4 3 6 5 7 3 8 7 9 1 2 1 1 1 3 1 ...
result:
ok T=100000
Test #9:
score: 0
Accepted
time: 127ms
memory: 3820kb
input:
100000 7 3 4 5 2 6 6 3 6 0 8 3 8 6 5 1 8 2 7 7 5 1 8 4 7 0 1 1 1 0 1 1 8 7 8 0 6 2 3 7 5 2 1 3 5 8 4 5 1 0 8 7 7 5 3 3 3 6 5 6 4 1 5 0 7 8 0 8 1 4 5 2 6 5 5 2 0 6 8 2 3 0 0 1 7 2 3 1 3 5 2 4 1 3 7 3 3 3 1 5 2 7 8 2 1 8 0 2 1 7 1 5 7 8 1 6 2 3 6 2 0 0 1 6 7 6 8 2 2 0 4 0 3 1 4 3 0 4 7 5 3 3 7 0 6 8 8...
output:
13 6 0 2 1 3 2 4 3 2 4 6 5 6 6 3 7 6 8 1 0 1 1 1 3 1 2 14 7 0 2 1 7 2 5 3 5 4 1 5 8 6 2 7 7 8 7 9 1 2 1 1 1 3 1 0 11 4 0 7 2 3 3 7 4 1 6 1 7 1 8 1 2 1 1 1 3 1 0 11 7 2 6 3 8 4 6 6 2 7 3 8 7 9 1 1 1 0 1 2 1 3 12 4 0 1 1 2 3 5 4 8 5 4 6 5 7 1 8 1 0 1 2 1 3 1 1 14 7 0 6 1 6 2 4 3 3 4 3 5 3 6 6 7 5 8 6 ...
result:
ok T=100000
Test #10:
score: 0
Accepted
time: 136ms
memory: 3896kb
input:
100000 7 8 0 3 2 6 7 9 8 7 7 8 8 5 0 0 6 8 7 7 6 6 0 8 8 9 9 2 1 8 4 7 7 8 2 1 1 3 5 4 1 6 9 6 6 4 0 5 0 2 7 1 7 1 1 2 9 8 5 7 5 3 6 6 1 1 8 4 5 8 4 5 3 0 9 2 8 5 5 4 0 4 9 2 1 4 1 4 0 1 3 4 7 9 0 8 6 5 8 5 4 1 2 1 0 0 2 0 4 9 2 9 0 9 5 7 4 7 6 5 9 3 4 5 9 6 3 2 0 2 3 2 3 4 7 4 6 6 0 7 7 1 5 9 5 6 1...
output:
13 6 0 7 1 2 3 2 4 6 5 7 6 9 7 8 8 6 9 1 0 1 9 1 1 1 3 12 6 0 7 1 7 2 4 3 6 6 8 7 7 8 7 9 1 1 1 0 1 2 1 3 13 5 0 5 1 7 3 8 4 9 5 9 6 2 7 1 8 7 9 1 1 1 9 1 3 1 0 14 3 0 6 1 6 2 7 3 2 4 1 5 1 6 3 7 5 8 4 9 1 0 1 1 1 2 1 3 11 5 1 8 2 5 3 6 4 4 5 5 7 2 9 1 0 1 2 1 3 1 1 12 6 0 6 2 1 4 2 5 9 6 8 7 5 8 7 ...
result:
ok T=100000
Test #11:
score: 0
Accepted
time: 143ms
memory: 3780kb
input:
100000 0 8 3 9 3 7 10 1 5 1 7 7 2 3 5 7 4 5 2 6 6 1 7 7 6 3 4 5 10 7 7 3 3 8 9 0 1 8 1 5 0 6 1 0 5 2 0 4 7 3 9 7 7 3 1 7 8 10 8 7 4 7 3 7 0 2 2 10 0 10 8 9 5 1 4 7 4 6 4 9 1 1 7 7 8 5 7 5 3 2 3 6 6 8 4 5 5 10 3 10 10 1 7 5 1 5 6 5 9 0 9 1 0 0 0 3 6 1 0 0 5 9 9 8 10 8 1 1 1 4 2 5 10 5 7 3 7 2 4 6 1 8...
output:
12 7 1 2 2 8 3 3 4 7 5 10 6 5 8 1 9 1 1 1 2 1 3 1 7 14 6 0 6 1 1 2 2 3 5 4 7 5 4 6 5 7 2 8 6 9 1 1 1 2 1 3 1 0 13 5 0 6 2 6 3 6 4 3 5 4 6 5 7 10 8 7 9 1 0 1 2 1 1 1 3 13 6 0 2 1 2 2 7 3 9 4 1 6 8 7 1 8 5 9 1 0 1 1 1 2 1 3 10 5 1 4 4 2 5 3 7 7 8 3 9 1 4 1 2 1 1 1 7 14 8 0 6 1 6 2 2 3 1 4 7 5 8 6 10 7...
result:
ok T=100000
Test #12:
score: 0
Accepted
time: 171ms
memory: 3964kb
input:
100000 494719969 120370150 440274545 51278543 770105708 138663251 867692060 230246532 162623412 131761825 16498099 70750104 350416959 359532393 346253463 539196901 104480711 629723297 27266106 267471731 320561715 423589912 850677494 604957917 815663121 8935553 252297110 812216267 821793396 495865924...
output:
14 494719968 0 120370149 1 440274544 2 51278542 3 770105708 4 138663251 5 867692060 6 230246532 7 162623412 8 131761825 9 1 0 1 2 1 3 1 1 14 16498098 0 70750103 1 350416958 2 359532392 3 346253463 4 539196901 5 104480711 6 629723297 7 27266106 8 267471731 9 1 0 1 1 1 2 1 3 14 320561714 0 423589911 1...
result:
ok T=100000
Test #13:
score: 0
Accepted
time: 75ms
memory: 3916kb
input:
100000 1 0 0 0 0 0 738556701 0 0 0 0 376417170 0 0 0 1 0 0 0 0 0 0 0 169526540 0 1 0 0 0 0 0 0 1 0 0 0 0 0 822697278 0 0 0 0 0 121828077 0 0 0 1 0 0 994528277 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 771142048 0 0 0 0 0 77945594 0 0 1 0 1 0 0 0 963629977 0 0 0 0 0 0 0 0 1 0 805871384 0 0 0 0 0 0 0 0 306368...
output:
6 738556696 6 0 0 1 0 0 7 5 6 0 0 6 376417165 1 0 8 1 5 0 0 5 1 0 8 6 169526535 3 0 0 1 5 0 0 5 3 0 0 6 0 1 822697275 8 1 2 0 9 0 1 3 8 6 121828075 4 0 0 0 1 1 8 2 4 0 0 -1 6 0 2 771142045 9 1 6 0 0 0 2 3 9 6 77945590 5 0 0 0 1 1 8 4 5 0 0 6 963629973 4 0 0 1 0 0 7 4 4 0 0 6 805871384 5 0 0 1 3 0 0 ...
result:
ok T=100000
Test #14:
score: 0
Accepted
time: 108ms
memory: 3920kb
input:
100000 2 969002522 0 0 0 0 0 0 0 0 0 0 0 902830660 0 0 2 0 0 0 0 0 0 0 1 0 216346913 0 1 0 365035921 0 0 0 0 0 0 0 1 1 0 0 0 447294079 0 0 0 0 2 0 173545560 0 0 0 0 0 0 1 0 1 236545965 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2 0 104167147 1 0 94723253 1 0 0 0 0 0 0 0 1 0 0 0 474995039 0 0 0 1 0 0 0 1 0 0 0 ...
output:
6 969002519 1 1 0 1 1 1 1 1 1 1 0 6 902830657 3 1 3 1 6 1 3 1 3 1 6 10 216346910 6 0 0 1 4 0 0 3 6 0 0 0 1 1 8 0 6 0 0 10 365035917 0 0 7 0 1 1 8 4 0 0 7 0 2 1 9 0 0 0 7 6 447294076 3 1 3 1 8 1 3 1 8 1 3 -1 10 236545965 0 0 7 1 1 0 8 0 0 0 7 1 4 0 0 0 0 0 7 6 104167144 9 1 7 1 9 1 7 1 9 1 9 10 94723...
result:
ok T=100000
Test #15:
score: 0
Accepted
time: 100ms
memory: 3780kb
input:
100000 311478020 904726460 0 0 0 0 0 0 0 0 0 793041969 693575215 0 0 0 0 0 0 0 0 941737673 0 0 0 0 0 0 128543983 0 374609698 0 0 0 82357820 0 0 0 0 0 184062618 0 0 0 0 118822886 0 0 0 0 447628754 0 0 0 0 0 0 0 0 0 0 0 0 0 395001081 0 0 0 483827406 0 0 0 0 154010312 172784409 0 0 0 0 0 247587485 0 0 ...
output:
7 311478018 0 904726457 1 1 0 1 1 1 1 1 1 1 0 7 793041966 1 693575213 2 1 2 1 1 1 2 1 1 1 1 2 941737673 1 128543983 8 7 374609695 0 82357818 4 1 0 1 4 1 0 1 0 1 4 7 184062615 0 118822884 5 1 0 1 5 1 0 1 0 1 5 2 447628754 0 0 7 7 395001079 4 483827403 8 1 4 1 4 1 8 1 8 1 8 7 154010310 3 172784406 4 1...
result:
ok T=100000
Test #16:
score: 0
Accepted
time: 113ms
memory: 3904kb
input:
100000 0 1 0 440498132 475368075 0 0 0 0 0 288355410 611487928 1 0 0 0 0 0 0 0 263421914 0 1 0 0 0 0 0 0 978202847 580168824 0 0 0 0 0 227097610 1 0 0 0 0 1 0 0 0 260392256 0 0 301522084 0 0 0 0 0 0 0 18629803 0 779668569 119647696 0 0 0 1 792598128 0 0 0 0 0 0 0 13823891 0 0 466308612 1 0 0 0 12790...
output:
7 440498130 3 475368073 4 1 1 1 3 1 4 1 3 1 4 7 288355408 0 611487926 1 1 0 1 0 1 2 1 1 1 1 7 263421912 0 978202845 9 1 2 1 9 1 9 1 0 1 0 8 580168821 0 227097608 6 1 7 1 0 1 0 1 6 1 0 1 6 7 260392254 6 301522082 9 1 2 1 9 1 6 1 9 1 6 7 18629801 7 779668566 9 1 9 1 7 1 9 1 7 1 9 7 119647694 0 7925981...
result:
ok T=100000
Test #17:
score: 0
Accepted
time: 116ms
memory: 3900kb
input:
100000 1 0 1 665089540 0 0 0 400911568 0 0 0 1 901713946 0 424657419 1 0 0 0 0 846736084 0 1 1 0 0 818156688 0 0 0 816527475 0 0 0 832798747 1 0 0 0 0 872170099 916780987 1 0 0 0 1 0 0 0 0 656299015 0 0 0 0 719473525 0 0 0 0 0 0 0 0 365480922 0 981383930 1 0 1 474342127 0 978193314 0 0 0 0 1 0 0 0 0...
output:
7 665089538 3 400911567 7 1 0 1 3 1 2 1 7 1 3 6 901713945 2 424657418 4 1 1 1 2 1 5 1 4 6 846736083 0 818156687 6 1 2 1 3 1 6 1 0 7 816527473 0 832798745 4 1 0 1 4 1 4 1 0 1 5 6 872170098 0 916780986 1 1 0 1 1 1 2 1 6 7 656299013 1 719473522 6 1 6 1 6 1 6 1 1 1 1 7 365480920 5 981383928 7 1 5 1 7 1 ...
result:
ok T=100000