QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#629099 | #1845. Permute | light_ink_dots | Compile Error | / | / | C++20 | 954b | 2024-10-11 03:50:55 | 2024-10-11 03:50:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int iv9=4;
int T,m,now,flg;
int c[10],p[10s];
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;
}
int main(){
scanf("%d",&T);
int cs=0;
while(T--){
cs++;
m=now=flg=0;
for(int i=0;i<=9;i++)
scanf("%d",&c[i]);
if(cs!=13)
continue;
for(int i=0;i<=9;i++)
scanf("%d%c",c[i],i==9? '\n':' ');
for(int i=0;i<=9&&m<8;i++)
while(m<8&&c[i])
c[i]--,p[++m]=i;
for(int i=0;i<=9;i++){
int v=pow10(c[i]);
now=(now*v+(v-1)*iv9*i)%7;
}
now=now*pow10(m)%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;
}
Details
answer.code:5:13: error: could not convert ‘std::literals::chrono_literals::operator""s<'1', '0'>()’ from ‘std::chrono::seconds’ {aka ‘std::chrono::duration<long int>’} to ‘long unsigned int’ 5 | int c[10],p[10s]; | ^~~ | | | std::chrono::seconds {aka std::chrono::duration<long int>} answer.code:5:13: error: size of array ‘p’ has non-integral type ‘std::chrono::seconds’ {aka ‘std::chrono::duration<long int>’} answer.code: In function ‘int main()’: answer.code:23:33: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=] 23 | scanf("%d%c",c[i],i==9? '\n':' '); | ~^ ~~~~ | | | | int* int answer.code:23:35: warning: format ‘%c’ expects argument of type ‘char*’, but argument 3 has type ‘int’ [-Wformat=] 23 | scanf("%d%c",c[i],i==9? '\n':' '); | ~^ ~~~~~~~~~~~~~~ | | | | char* int answer.code:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d",&T); | ~~~~~^~~~~~~~~ answer.code:19:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d",&c[i]); | ~~~~~^~~~~~~~~~~~ answer.code:23:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | scanf("%d%c",c[i],i==9? '\n':' '); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~