結果
| 問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-05-09 16:53:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 83 ms / 2,000 ms |
| コード長 | 662 bytes |
| 記録 | |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 29,944 KB |
| 実行使用メモリ | 18,028 KB |
| 最終ジャッジ日時 | 2025-06-22 03:08:02 |
| 合計ジャッジ時間 | 7,666 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 45 RE * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:11: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘LL*’ {aka ‘long long int*’} [-Wformat=]
15 | scanf("%d%d%d%d",&N,&K,&X,&Y);
| ~^ ~~
| | |
| int* LL* {aka long long int*}
| %lld
main.cpp:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%d%d%d%d",&N,&K,&X,&Y);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:17:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | rep(i,K){ int a; scanf("%d",&a); A[a]=dp[a][a]=1; }
| ~~~~~^~~~~~~~~
ソースコード
#include<stdio.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0;i<(n);i++)
const int Z=1024;
LL N;
int K,X,Y;
int A[Z]={};
ULL dp[Z][Z]={};
ULL buf[Z][Z]={};
int main(){
scanf("%d%d%d%d",&N,&K,&X,&Y);
if(K == 1 && N >= 2){ printf("0\n"); return 0; }
rep(i,K){ int a; scanf("%d",&a); A[a]=dp[a][a]=1; }
rep(i,N-1){
rep(x,Z){
ULL S=0; rep(y,Z) S+=dp[x][y];
rep(y,Z) if(A[y]) buf[x^y][y] = S-dp[x][y];
}
rep(x,Z) rep(y,Z){ dp[x][y]=buf[x][y]; buf[x][y]=0; }
}
ULL ans=0;
rep(x,Z) rep(y,Z) if(X<=x && x<=Y) ans+=dp[x][y];
printf("%lld\n",ans%998244353);
return 0;
}
Nachia