結果
| 問題 |
No.8046 yukicoderの過去問
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-07 21:02:29 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 470 bytes |
| コンパイル時間 | 624 ms |
| コンパイル使用メモリ | 50,944 KB |
| 最終ジャッジ日時 | 2025-01-07 01:29:53 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 TLE * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d%d",&K,&N);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:15:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | for(int i=0,y;i<N;i++)scanf("%d",&y),x[y]=1;
| ~~~~~^~~~~~~~~
ソースコード
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <vector>
#include <cstdio>
using namespace std;
int k[1<<17],x[1<<17];
const int M=1000000007;
int main(){
int K,N;
scanf("%d%d",&K,&N);
//vector<int> k(K+1);
//vector<int> x(K);
k[0]=1;
for(int i=0,y;i<N;i++)scanf("%d",&y),x[y]=1;
for(int l=0;l<K;l++){
int v=k[l];
for(int i=0;l+i<=K;i++){
k[l+i]+=x[i]*v;
//if(k[l+i]>=M)k[l+i]-=M;
k[l+i]-=M*(k[l+i]>=M);
}
}
printf("%d\n",k[K]);
}