QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#719847 | #9562. 欧伊昔 | wsc2008 | 50 | 63ms | 57080kb | C++14 | 2.0kb | 2024-11-07 09:21:45 | 2024-11-07 09:21:45 |
Judging History
answer
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll,ll>
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define per(i,a,b) for(ll i=(a);i>=(b);--i)
using namespace std;
bool Mbe;
ll read(){
ll x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
void write(ll x){
if(x<0)putchar('-'),x=-x;
if(x>9)write(x/10);
putchar(x%10+'0');
}
const ll N=1.8e5+9;
ll n,pw3[12],op[3][3],a[N],b[N],c[N],D;
ll f[12][N],g[12][N],h[12][N];
ll p[5][3],q[5][3],r[5][3];
void Karatsuba(ll d){
if(d==1){
rep(i,0,2)h[d][i]=0;
rep(i,0,2){
rep(j,0,2)h[d][op[i][j]]+=f[d][i]*g[d][j];
}
return ;
}
ll L=pw3[d-1];
rep(i,0,L*3-1)h[d][i]=0;
rep(t,0,D-1){
rep(i,0,L-1){
f[d-1][i]=f[d][i]*p[t][0]+f[d][i+L]*p[t][1]+f[d][i+L+L]*p[t][2];
g[d-1][i]=g[d][i]*q[t][0]+g[d][i+L]*q[t][1]+g[d][i+L+L]*q[t][2];
}
Karatsuba(d-1);
rep(i,0,L-1){
h[d][i]+=h[d-1][i]*r[t][0];
h[d][i+L]+=h[d-1][i]*r[t][1];
h[d][i+L+L]+=h[d-1][i]*r[t][2];
}
}
}
bool Med;
int main(){
cerr<<fabs(&Med-&Mbe)/1048576.0<<"MB\n";
rep(i,0,2){
rep(j,0,2)op[i][j]=read();
}
n=read();
pw3[0]=1;
rep(i,1,n)pw3[i]=pw3[i-1]*3;
rep(i,0,pw3[n]-1)a[i]=read();
rep(i,0,pw3[n]-1)b[i]=read();
rep(i,0,pw3[n]-1)f[n][i]=a[i],g[n][i]=b[i];
D=4;
rep(i,0,2)p[0][i]=q[0][i]=1;
rep(i,0,2){
rep(j,0,2){
if(op[i][j]==1)q[i+1][j]=1;
p[i+1][i]=1;
}
}
r[1][1]=r[2][1]=r[3][1]=1;
r[0][0]=1,r[1][0]=r[2][0]=r[3][0]=-1;
Karatsuba(n);
rep(i,0,pw3[n]-1)c[i]=h[n][i];
rep(i,0,pw3[n]-1)write(c[i]),putchar(' ');
putchar('\n');
cerr<<"\n"<<clock()*1.0/CLOCKS_PER_SEC*1000<<"ms\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 0ms
memory: 12132kb
input:
0 1 2 1 2 0 2 0 1 1 7 1 5 8 4 5
output:
81 61 79
result:
ok single line: '81 61 79 '
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 24436kb
input:
0 1 2 1 2 0 2 0 1 3 6 4 1 8 7 9 6 1 4 1 6 4 5 8 2 5 2 8 1 8 7 9 8 1 1 8 8 9 6 5 9 8 7 5 0 4 7 7 1 1 8 0 9 2 2 8 9 3 8 8 5 2 1 5
output:
2795 2827 2842 1344 1485 1515 0 0 0 1441 1419 1381 676 751 706 0 0 0 0 0 0 0 0 0 0 0 0
result:
wrong answer 1st lines differ - expected: '697 607 678 641 734 754 699 75...706 636 703 751 761 713 764 754', found: '2795 2827 2842 1344 1485 1515 ...51 706 0 0 0 0 0 0 0 0 0 0 0 0 '
Subtask #2:
score: 0
Wrong Answer
Test #6:
score: 5
Accepted
time: 0ms
memory: 13972kb
input:
1 2 1 2 0 0 1 0 0 1 8 9 3 1 6 1
output:
84 19 57
result:
ok single line: '84 19 57 '
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 22148kb
input:
1 2 1 2 0 0 1 0 0 3 0 9 8 8 9 2 6 5 1 7 2 9 8 8 7 9 1 9 8 0 3 6 8 6 6 1 6 2 7 1 0 3 4 9 1 7 3 1 3 3 6 1 4 6 7 3 9 5 0 6 5 6 6 8
output:
3919 2654 1922 1505 1449 751 0 0 0 1676 1099 818 984 446 409 0 0 0 0 0 0 0 0 0 0 0 0
result:
wrong answer 1st lines differ - expected: '2070 1350 930 936 1077 524 774...715 415 569 372 227 360 144 155', found: '3919 2654 1922 1505 1449 751 0...46 409 0 0 0 0 0 0 0 0 0 0 0 0 '
Subtask #3:
score: 20
Accepted
Test #11:
score: 20
Accepted
time: 0ms
memory: 14180kb
input:
1 1 1 0 0 0 1 1 1 1 6 2 1 3 1 5
output:
18 63 0
result:
ok single line: '18 63 0 '
Test #12:
score: 20
Accepted
time: 0ms
memory: 22368kb
input:
1 1 0 0 0 1 0 0 1 3 4 6 4 5 6 8 7 7 4 0 0 9 1 0 9 0 8 5 3 4 0 0 4 2 3 5 1 4 2 5 5 6 2 4 6 5 2 5 0 0 4 0 6 3 8 1 2 3 7 0 6 8 4 8
output:
1776 1049 0 1615 1167 0 0 0 0 1582 1203 0 1536 1202 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok single line: '1776 1049 0 1615 1167 0 0 0 0 ...1202 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #13:
score: 20
Accepted
time: 0ms
memory: 32604kb
input:
1 1 1 1 1 1 0 0 0 6 8 7 3 9 0 9 3 3 8 3 2 4 9 8 4 1 2 9 0 3 1 8 7 9 9 4 0 4 6 6 7 2 2 1 4 4 4 3 6 7 8 0 2 7 4 9 8 6 2 9 9 8 3 7 6 4 1 2 2 0 3 0 3 9 8 5 9 3 5 6 4 1 9 6 3 2 9 4 9 2 7 5 0 3 0 2 7 5 4 5 6 1 9 3 7 2 6 3 2 3 5 3 3 0 8 1 4 0 1 1 4 5 0 0 2 1 8 3 6 6 3 0 1 9 3 4 9 2 7 1 2 8 5 1 4 3 4 9 8 5 ...
output:
12752 31880 0 31880 41444 0 0 0 0 38256 76512 0 54196 117956 0 0 0 0 0 0 0 0 0 0 0 0 0 38256 76512 0 66948 143460 0 0 0 0 51008 98828 0 191280 210408 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 38256 70136 0 63760 102016 0 0 0 0 79700 111580 0 105204 219972 0 0 0 ...
result:
ok single line: '12752 31880 0 31880 41444 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #14:
score: 20
Accepted
time: 0ms
memory: 44948kb
input:
0 0 1 0 0 1 0 0 1 9 3 5 7 4 5 0 9 0 8 1 6 7 7 2 6 3 2 9 8 2 8 1 5 2 0 0 1 0 6 5 8 6 9 3 2 1 8 3 0 9 2 9 0 2 6 0 0 4 0 6 2 7 8 7 9 8 8 8 4 5 1 1 8 3 1 1 6 2 6 9 4 9 2 9 4 7 3 7 0 8 3 3 1 5 8 8 6 3 5 3 9 6 1 8 1 7 4 6 4 7 1 8 4 1 3 3 3 3 0 7 5 5 2 4 0 0 9 7 2 6 0 9 0 9 6 3 0 5 0 8 3 4 3 0 3 4 8 5 9 6 ...
output:
203913878 109813438 0 98983010 49535892 0 0 0 0 102800292 53353174 0 55217428 20418020 0 0 0 0 0 0 0 0 0 0 0 0 0 107949184 50068536 0 53708270 24324076 0 0 0 0 56549038 23791432 0 27963810 13316100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 99071784 48115508 0 49...
result:
ok single line: '203913878 109813438 0 98983010... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #15:
score: 20
Accepted
time: 63ms
memory: 56952kb
input:
0 0 0 0 0 0 0 0 0 11 4 2 4 1 1 1 9 6 0 9 2 5 4 0 4 7 7 3 5 4 2 4 3 7 1 2 4 6 7 0 1 1 4 4 1 2 9 3 9 5 0 1 9 8 7 8 9 0 9 8 4 2 8 8 4 2 2 0 8 7 7 9 7 8 6 8 7 7 8 1 6 2 4 3 9 3 9 9 2 7 0 7 2 3 7 5 9 5 2 1 6 3 3 0 8 4 2 8 3 7 2 5 4 9 8 4 5 1 3 7 5 1 4 3 8 8 4 3 3 6 9 5 4 8 5 1 7 1 9 0 5 7 8 0 6 5 5 2 7 9...
output:
635411468335 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok single line: '635411468335 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Subtask #4:
score: 30
Accepted
Test #16:
score: 30
Accepted
time: 2ms
memory: 14120kb
input:
1 1 1 0 0 1 1 1 0 1 1 0 9 8 1 9
output:
81 99 0
result:
ok single line: '81 99 0 '
Test #17:
score: 30
Accepted
time: 0ms
memory: 20260kb
input:
0 0 1 0 0 1 1 1 0 3 7 6 2 7 7 9 5 5 6 0 5 7 5 8 1 0 6 0 9 3 3 5 1 8 2 2 1 8 5 9 1 0 0 0 4 9 1 4 3 2 5 1 9 2 2 8 7 6 8 7 3 9 1 0
output:
2402 1847 0 1687 1320 0 0 0 0 2363 1614 0 1492 955 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok single line: '2402 1847 0 1687 1320 0 0 0 0 ... 955 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #18:
score: 30
Accepted
time: 0ms
memory: 34664kb
input:
1 0 0 0 1 0 1 0 1 6 4 6 4 1 9 6 7 6 7 5 0 7 4 1 5 7 5 7 4 7 9 7 6 3 3 8 5 4 4 0 8 8 9 2 8 3 5 9 3 1 4 1 1 5 7 7 7 5 7 4 9 8 1 0 7 9 3 8 4 8 2 9 5 3 4 0 5 3 8 2 7 8 8 7 4 8 5 2 4 2 1 0 6 1 7 0 1 2 9 8 3 5 9 9 0 1 6 3 9 7 0 1 9 8 4 4 4 3 1 4 5 4 4 6 2 2 7 2 6 5 8 5 4 5 9 7 4 1 7 1 3 2 6 3 6 0 0 5 9 6 ...
output:
322011 265965 0 260223 215956 0 0 0 0 263733 211227 0 215511 174371 0 0 0 0 0 0 0 0 0 0 0 0 0 266760 215095 0 211273 172309 0 0 0 0 214580 167887 0 173403 135852 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 253574 204516 0 204277 166421 0 0 0 0 207948 162851 0 1729...
result:
ok single line: '322011 265965 0 260223 215956 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #19:
score: 30
Accepted
time: 3ms
memory: 46940kb
input:
0 0 0 1 0 1 1 0 1 9 4 2 6 7 4 0 9 7 7 1 6 0 1 4 4 6 7 0 8 4 1 3 2 2 0 6 6 8 9 7 0 3 8 9 4 1 8 6 5 7 5 4 2 8 3 7 9 6 1 7 5 2 9 2 7 9 7 1 2 1 3 4 4 7 0 7 3 9 7 6 5 3 8 7 0 4 6 2 7 4 0 6 0 4 4 1 2 0 7 4 2 2 4 6 8 0 3 2 2 1 8 7 7 7 8 3 2 4 6 4 4 8 2 4 6 5 0 0 1 7 5 0 6 7 3 4 4 3 5 6 8 1 9 2 5 1 6 0 6 5 ...
output:
40385937 31934762 0 31782968 25077003 0 0 0 0 31023309 24888805 0 23789431 19681164 0 0 0 0 0 0 0 0 0 0 0 0 0 31987079 25546274 0 25044943 19461021 0 0 0 0 25039688 19751368 0 19460419 15885046 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30628498 25280629 0 245971...
result:
ok single line: '40385937 31934762 0 31782968 2... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #20:
score: 30
Accepted
time: 61ms
memory: 57080kb
input:
1 0 1 0 1 1 0 1 1 11 1 2 3 9 6 4 9 3 8 9 5 9 4 3 3 2 9 6 1 8 0 4 2 5 2 0 7 6 8 0 1 7 9 7 2 8 7 2 4 5 3 1 6 7 8 9 5 2 2 2 7 5 2 6 9 1 5 1 9 4 9 6 0 3 6 2 1 1 0 7 7 8 0 8 7 6 7 9 3 7 8 7 3 3 0 5 9 1 7 3 5 4 3 3 1 1 6 4 2 7 4 1 4 3 4 7 0 7 2 5 6 9 5 9 1 6 4 9 6 9 7 9 2 2 5 3 7 3 7 5 9 8 9 7 1 7 7 6 0 2...
output:
3330757 6904276 0 6996758 14294336 0 0 0 0 7094512 14150626 0 14703887 29236909 0 0 0 0 0 0 0 0 0 0 0 0 0 6778135 14131886 0 14023801 28519549 0 0 0 0 14162278 28291932 0 28809996 57166032 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7085904 14086903 0 14087635 278...
result:
ok single line: '3330757 6904276 0 6996758 1429... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Subtask #5:
score: 0
Wrong Answer
Test #21:
score: 0
Wrong Answer
time: 0ms
memory: 46896kb
input:
0 2 2 1 1 1 0 1 1 9 2 7 2 7 4 5 9 7 9 6 8 4 0 6 3 3 6 3 0 5 2 3 7 6 7 8 3 6 1 1 6 9 9 2 7 2 1 2 8 2 9 3 5 0 5 7 1 2 3 1 4 8 0 4 3 4 2 8 8 4 2 9 3 7 1 1 6 6 4 0 9 6 5 8 8 1 3 8 7 3 0 4 3 8 7 0 0 7 6 4 3 6 0 2 3 3 6 5 0 5 9 8 6 1 0 4 7 8 2 4 7 4 8 6 9 6 3 5 1 8 0 1 4 7 0 0 1 2 7 7 0 5 5 3 8 2 7 8 9 8 ...
output:
2452297 7002289 2169522 3663957 8964943 3751897 0 0 0 3383536 8884194 3408735 3883475 11150687 3540325 0 0 0 0 0 0 0 0 0 0 0 0 3155540 7683205 3526677 4657350 11576102 4455564 0 0 0 4472125 10134089 4528918 5021176 12284605 4988252 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 1st lines differ - expected: '18440 36200 13740 21447 61214 ...176 81555 44223 4512 28578 4596', found: '2452297 7002289 2169522 366395... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #6:
0%