結果
| 問題 |
No.2082 AND OR XOR
|
| コンテスト | |
| ユーザー |
Ststone
|
| 提出日時 | 2022-10-18 15:32:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 2,492 bytes |
| コンパイル時間 | 1,976 ms |
| コンパイル使用メモリ | 201,400 KB |
| 最終ジャッジ日時 | 2025-02-08 08:04:11 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:18: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
26 | register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
| ^
main.cpp:26:20: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
26 | register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
| ^
main.cpp:26:22: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
26 | register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
| ^
main.cpp:26:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
26 | register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
| ^
main.cpp:26:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
26 | register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
| ^
main.cpp:26:30: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
26 | register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
| ^~
main.cpp:26:33: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
26 | register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
| ^~
main.cpp:26:36: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
26 | register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
| ^
main.cpp:26:38: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
26 | register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
| ^
main.cpp:26:40: warning: ISO C++17
ソースコード
#include <bits/stdc++.h>
#define int long long
#define double long double
#define pii pair<int,int>
#define F first
#define S second
#define no_more_love ios_base::sync_with_stdio(0),cin.tie(0)
#define pb push_back
//#define P pair<int,int>
using namespace std;
const int maxn=5005,MOD=998244353;
int ar[5][5];
bool vis[maxn];
int cnt[maxn];
int ar2[maxn];
map<int,int>mp;
vector<int>v[maxn],v2,v3;
int dp[maxn][5][5],dp2[maxn],n,m;//dp[i][j][k]代表第i個位置由前為j,由後應為k
set<int>s,ss;
//queue<int>q;
deque<int>dq;
signed main()
{
no_more_love;
register int t,i,j,a=0,b,a1,b1,k,d,cnt2,flag,flag2,a2,c,x,y,z;
t=1;
string s1,s2;
char cccc,ccccc;
//cin>>t;
while(t--){
cin>>n>>a>>b>>c;
for(i=0;i<4;i++){
for(j=0;j<4;j++){
ar[i][j]=(a*(i&j)+b*(i|j)+c*(i^j))%4;
}
}
int ans=0;
for(x=0;x<=3;x++){
for(i=0;i<=n;i++){
for(j=0;j<=3;j++){
for(k=0;k<=3;k++)dp[i][j][k]=0;
}
}
for(i=0;i<=3;i++){
for(j=0;j<=3;j++){
if(ar[i][j]==x)dp[1][i][j]+=1;
//assert(ar[i][j]==ar[j][i]);
}
}
/*dp[1][1][ar[1][x]]=1;
dp[1][2][ar[2][x]]=1;
dp[1][3][ar[3][x]]=1;
dp[1][0][ar[0][x]]=1;*/
for(i=2;i<=n-1;i++){
for(j=0;j<=3;j++){
for(y=0;y<=3;y++){
for(z=0;z<=3;z++){
for(a1=0;a1<=3;a1++){
if(ar[y][a1]==j){
for(k=0;k<=3;k++){
if(ar[k][a1]==z)dp[i][j][k]+=dp[i-1][y][z];
dp[i][j][k]%=MOD;
}
}
}
}
}
}
}
for(i=0;i<=3;i++){
for(j=0;j<=3;j++){
if(ar[i][j]==x){
ans+=dp[n-1][i][j];
}
}
}
/*for(i=0;i<=3;i++){
if(ar[i][x]==x){
ans+=dp[n][x][i];
}
}*/
//ans+=dp[n][x][0];
ans%=MOD;
}
cout<<ans<<'\n';
}
return 0;
}
/*
*/
Ststone