QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#244514 | #5744. Palindromic Differences | ucup-team870# | WA | 0ms | 5664kb | C++14 | 4.4kb | 2023-11-09 10:47:41 | 2023-11-09 10:47:42 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l; i<=r; i++)
#define per(i,r,l) for(int i=r; i>=l; i--)
#define IOS {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);}
using namespace std;
#define db double
typedef long long ll;
typedef pair<int,int> P;
// const int mod=1e9+9;
int a[2<<20];
int A[1000][1000];
// ll qp(ll x,ll y){
// ll an=1;
// while(y){
// if (y&1) an=an*x%mod;
// x=x*x%mod; y>>=1;
// }
// return an;
// }
ll cal(int n){
rep(i,0,n-1){
rep(j,0,n-1){
A[i][j]=a[i|j];
}
}
// ll ans=1;
db ans=1;
rep(c,0,n-1){
rep(r,c,n-1){
if(A[r][c]){
swap(A[r],A[c]);
if(r!=c)ans*=-1;
break;
}
}
if(!A[c][c])return 0;
rep(i,c+1,n-1){
// ll iv=A[i][c]*qp(A[c][c],mod-2)%mod;
db iv=A[i][c]/A[c][c];
// rep(k,c,n-1)A[i][k]=(A[i][k]-A[c][k]*iv)%mod;
rep(k,c,n-1)A[i][k]-=A[c][k]*iv;
}
ans=ans*A[c][c];
}
// return (ans%mod+mod)%mod;
return ans;
}
int main() {
int n=2;
// a[0]=3; a[1]=1; a[2]=5; a[3]=4;
// cout<<cal(4); return 0;
rep(a0,0,3){
a[0]=a0;
rep(a1,0,3){
a[1]=a1;
rep(a2,0,3){
a[2]=a2;
rep(a3,0,3){
a[3]=a3;
cout<<a0<<" "<<a1<<" "<<a2<<" "<<a3<<" "<<cal(1<<n)<<endl;
}
}
}
}
return 0;
}
/*
0 0 0 0 0
0 0 0 1 1
0 0 0 2 16
0 0 0 3 81
0 0 1 0 0
0 0 1 1 0
0 0 1 2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 2 24
3 1 0 3 162
3 1 1 0 0
3 1 1 1 0
3 1 1 2 18
3 1 1 3 144
3 1 2 0 0
3 1 2 1 0
3 1 2 2 0
3 1 2 3 126
3 1 3 0 0
3 1 3 1 0
3 1 3 2 0
3 1 3 3 0
3 2 0 0 0
3 2 0 1 -6
3 2 0 2 0
3 2 0 3 0
3 2 1 0 0
3 2 1 1 0
3 2 1 2 0
3 2 1 3 0
3 2 2 0 0
3 2 2 1 12
3 2 2 2 0
3 2 2 3 0
3 2 3 0 0
3 2 3 1 0
3 2 3 2 0
3 2 3 3 0
3 3 0 0 0
3 3 0 1 0
3 3 0 2 0
3 3 0 3 0
3 3 1 0 0
3 3 1 1 0
3 3 1 2 0
3 3 1 3 0
3 3 2 0 0
3 3 2 1 0
3 3 2 2 0
3 3 2 3 0
3 3 3 0 0
3 3 3 1 -12
3 3 3 2 -6
3 3 3 3 0
*/
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 5664kb
input:
5 3 2 3 1 4 1 1 1 1 3 1 2 4 7 0 200 0 200 50 100 150 14 -1 0 1 2 3 4 5 6 7 8 9 10 11 12
output:
0 0 0 0 0 0 0 0 1 1 0 0 0 2 16 0 0 0 3 81 0 0 1 0 0 0 0 1 1 0 0 0 1 2 4 0 0 1 3 36 0 0 2 0 0 0 0 2 1 4 0 0 2 2 0 0 0 2 3 0 0 0 3 0 0 0 0 3 1 9 0 0 3 2 36 0 0 3 3 0 0 1 0 0 0 0 1 0 1 0 0 1 0 2 4 0 1 0 3 36 0 1 1 0 0 0 1 1 1 0 0 1 1 2 0 0 1 1 3 0 0 1 2 0 0 0 1 2 1 0 0 1 2 2 0 0 1 2 3 0 0 1 3 0 0 0 1 3...
result:
wrong answer 1st numbers differ - expected: '2', found: '0'