結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー KKT89
提出日時 2020-12-01 18:12:19
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 1,625 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 28,460 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-22 02:40:14
合計ジャッジ時間 5,964 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 45 RE * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:46:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   46 |     scanf("%d%d%d%d",&n,&m,&x,&y);y++;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:48:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   48 |         scanf("%d",&a);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <stdio.h>
typedef long long int ll;

// struct fastI{
//     char in[1<<26];
//     char const*o;
//     fastI(){
//         o = in; 
//         in[fread(in,1,sizeof(in)-4,stdin)]=0;
//     }
//     fastI& operator>>(char& c){
//         while(*o&&*o<=32)++o;
//         c=*o++;
//         return *this;
//     }
//     fastI& operator>>(int& u){
//         u=0; 
//         unsigned s=0;
//         while(*o&&*o<=32)++o;
//         if (*o == '-')s = ~s, ++o; else if (*o == '+')++o;
//         while('0'<=*o && *o<='9')u = (u<<3) + (u << 1) + (*o++ - '0');
//         (u^=s)+=!!s;
//         return *this;
//     }
//     fastI& operator>>(long long& u){
//         u=0;
//         uint64_t s=0;
//         while(*o&&*o<=32)++o;
//         if (*o == '-')s = ~s, ++o; else if (*o == '+')++o;
//         while('0'<=*o && *o<='9')u = (u<<3) + (u << 1) + (*o++ - '0');
//         (u^=s)+=!!s;
//         return *this;
//     }
// } fin;

const ll mod=998244353;
const int N=1024;

int A[1024];
ll dp[42][1024];
int n,k,m,x,y,a;

int main(){
    scanf("%d%d%d%d",&n,&m,&x,&y);y++;
    for(int i=0;i<m;i++){
        scanf("%d",&a);
        k+=(A[a]?0:++A[a]);
    }
    dp[0][0]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<N;j++){
            if(dp[i][j]==0)continue;
            for(int l=0;l<N;l++){
                dp[i+1][j^l]+=A[l]*dp[i][j];
            }
            dp[i+2][j]-=dp[i][j]*(k-(i>0));
        }
    }
    ll res=0;
    for(int i=x;;i++){
        if(i==N || i==y)break;
        res+=dp[n][i];
    }
    res%=mod;
    printf("%lld\n",res);
}
0