QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#630440#1845. Permutelight_ink_dotsWA 212ms3940kbC++20987b2024-10-11 18:33:372024-10-11 18:33:43

Judging History

This is the latest submission verdict.

  • [2024-10-11 18:33:43]
  • Judged
  • Verdict: WA
  • Time: 212ms
  • Memory: 3940kb
  • [2024-10-11 18:33:37]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int iv9=4;
int T,m,now,flg;
int c[100],d[100],p[100];
int pow10(int n){//10^n mod 7
	int res=1;
	for(int i=1;i<=n%6;i++)
		res=10*res%7;
	return res;
}
inline int cmp(int a,int b){
	return c[a]>c[b];
}
void op(int x,int T=1){
	while(T--)
		c[x]--,p[++m]=x;
}
int main(){
	scanf("%d",&T);
	while(T--){
		m=now=flg=0;
		for(int i=0;i<=9;i++)
			scanf("%d",&c[i]),d[i]=i;
		sort(d,d+10,cmp);
			for(int i=1;i<=10;i++)
				for(int j=0;j<=9;j++)
					if(c[j]&&m<10)
						op(j,1);
		for(int i=0;i<=9;i++){
			int v=pow10(c[i]);
			now=(now*v+(v-1)*iv9*i)%7;
		}
		do{
			int cur=now;
			for(int i=1;i<=m;i++)
				cur=(cur*10+p[i])%7;
			if(cur==0){
				flg=1,printf("%d\n",10+m);
				for(int i=0;i<=9;i++)
					printf("%d %d\n",c[i],i);
				for(int i=1;i<=m;i++)
					printf("1 %d\n",p[i]);
				break;
			}
		}while(next_permutation(p+1,p+1+m));
		if(flg==0)
			puts("-1");
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3900kb

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:

12
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
1 1
1 4
14
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
1 9
1 6
1 1
1 1
-1

result:

ok T=3

Test #2:

score: 0
Accepted
time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 5
1 6
1 8
1 8
1 0
1 2
20
0 0
0 1
0 2
0 3
0 4
1 5
0 6
0 7
1 8
0 9
1 0
1 1
1 3
1 4
1 5
1 7
1 1
1 9
1 6
1 8
20
0 0
1 1
1 2
0 3
0 4
1 5
0 6
0 7
1 8
1 9
1 0
1 1
1 2
1 3
1 5
1 6
1 7
1 9
1 0
1 8
19
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
1 0
1 1
...

result:

wrong answer Jury has the answer but participant has not