結果
問題 |
No.695 square1001 and Permutation 4
|
ユーザー |
|
提出日時 | 2018-06-08 23:26:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 568 bytes |
コンパイル時間 | 2,236 ms |
コンパイル使用メモリ | 165,772 KB |
実行使用メモリ | 159,744 KB |
最終ジャッジ日時 | 2024-07-22 19:16:59 |
合計ジャッジ時間 | 4,822 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 MLE * 7 |
ソースコード
#include <bits/stdc++.h> using namespace std; //vector<long long> P( 20000000 ); long long P[ 20000000 ]; const long long iMod = 100000000000000007; int main() { int i; int j; int k; int n; int m; int x[ 10 ]; ios::sync_with_stdio( false ); cin.tie( 0 ); cin >> n; cin >> m; for( i = 0; i < m; i++ ) cin >> x[ i ]; P[ 1 ] = 1; for( i = 1; i < n; i++ ) { if( P[ i ] == 0 ) continue; for( j = 0; j < m; j++ ) { k = i + x[ j ]; if( k <= n ) { P[ k ] += P[ i ]; P[ k ] %= iMod; } } } cout << P[ n ] << endl; return 0; }