QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#553094 | #7562. Except One | ucup-team1231# | WA | 1ms | 10108kb | C++17 | 2.5kb | 2024-09-08 08:25:45 | 2024-09-08 08:25:46 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ 1234567
struct state {
vector<int> vec[2][2];
state(char S[]) {
for(int i = 0; i < 2; i++)
for(int j = 0; j < 2; j++)
vec[i][j] = vector<int>{0, 0, 0};
for(int i = 0; i < 2; i ++) {
char ch = i == 0 ? 'R' : 'B';
if(S[1] == ch) continue;
if(S[0] != 'Y' && S[2] != 'Y') vec[0][0][1]++;
if(S[0] != 'Y' && S[2] != 'P') vec[0][1][1 + i]++;
if(S[0] != 'P' && S[2] != 'Y') vec[1][0][1 - i]++;
if(S[0] != 'P' && S[2] != 'P') vec[1][1][1]++;
}
}
};
typedef vector<int> vi;
typedef long long ll;
const int MOD=998244353;
#define sz(t) int((t).size())
vi operator + (const vi&A,const vi&B) {
vi C(max(sz(A),sz(B)));
for(int i=0;i<sz(A);++i) C[i]=A[i];
for(int i=0;i<sz(B);++i) (C[i]+=B[i])%=MOD;
return C;
}
int K;
ll qp(ll a,ll b) {
ll x=1; a%=MOD;
while(b) {
if(b&1) x=x*a%MOD;
a=a*a%MOD; b>>=1;
}
return x;
}
ll w[2][SZ];
void fftinit(int n) {
for(K=1;K<n;K<<=1);
ll ww=qp(3,(MOD-1)/K);
w[0][0]=1;
for(int i=1;i<=K;++i)
w[0][i]=w[0][i-1]*ww%MOD;
for(int i=0;i<=K;++i) w[1][i]=w[0][K-i];
}
void fft(int*a,int o) {
for(int i=0;i<K;++i) {
int br=i,s=0;
for(int j=1;j<K;j<<=1)
s=s*2+br%2,br/=2;
if(i<s) swap(a[i],a[s]);
}
for(int i=2;i<=K;i<<=1)
for(int l=0;l<K;l+=i)
for(int j=0;j<(i/2);++j) {
int &p=a[j+l],&q=a[l+j+(i/2)];
ll t=q*(ll)w[o][K/i*j]%MOD;
q=(p-t+MOD)%MOD;
p=(p+t)%MOD;
}
if(!o) return;
ll rk=qp(K,MOD-2);
for(int i=0;i<K;++i) a[i]=a[i]*(ll)rk%MOD;
}
vi operator * (const vi&A,const vi&B) {
if(A.empty()) return A;
if(B.empty()) return B;
int u=sz(A)+sz(B)-1;
vi C(u);
static int ta[SZ],tb[SZ];
fftinit(u);
for(int i=0;i<K;++i) ta[i]=(i<sz(A))?A[i]:0;
for(int i=0;i<K;++i) tb[i]=(i<sz(B))?B[i]:0;
fft(ta,0);fft(tb,0);
for(int i=0;i<K;++i) ta[i]=ta[i]*(ll)tb[i]%MOD;
fft(ta,1);
for(int i=0;i<u;++i) C[i]=ta[i];
return C;
}
state merge(const state& A, const state& B) {
}
state calc(int l, int r) {
}
int n;
char S[100005];
int main() {
vi a{1,2,3},b{3,2,1};
vi c=a*b;
for(auto t:c)
cout<<t<<" ";
cout<<"\n";
scanf("%d%s", &n, S);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 10108kb
input:
7 5 3
output:
3 8 14 8 3
result:
wrong answer 1st numbers differ - expected: '1', found: '3'