結果
| 問題 | No.612 Move on grid |
| コンテスト | |
| ユーザー |
りあん
|
| 提出日時 | 2017-11-23 04:01:24 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,500 ms |
| + 58µs | |
| コード長 | 870 bytes |
| 記録 | |
| コンパイル時間 | 979 ms |
| コンパイル使用メモリ | 183,188 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-18 22:17:06 |
| 合計ジャッジ時間 | 2,693 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/memory:71,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:58,
from main.cpp:1:
In function '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = int*; _ForwardIterator = int*]',
inlined from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _Sentinel, _ForwardIterator, allocator<_Tp>&) [with _InputIterator = int*; _Sentinel = int*; _ForwardIterator = int*; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/stl_uninitialized.h:637:37,
inlined from 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/vector.tcc:257:35,
inlined from 'int main()' at main.cpp:23:14:
/home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/stl_uninitialized.h:273:31: warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing between 1 and 88000 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
273 | __builtin_memcpy(std::__niter_base(__result),
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
274 | std::__niter_base(__first),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
275 | __n * sizeof(_ValT));
| ~~~~~~~~~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/allocator.h:46,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include
ソースコード
#include<bits/stdc++.h>
using namespace std;
const int M = 1000000007;
int main() {
int t, a, b, c, d, e;
cin >> t >> a >> b >> c >> d >> e;
const int m = 22000, s = 11000;
vector<int> dp(m, 0);
dp[s] = 1;
for (int i = 0; i < t; ++i) {
vector<int> nex(m, 0);
for (int j = 0; j < m; ++j) {
if (dp[j] > 0) {
nex[j + a] = (nex[j + a] + dp[j]) % M;
nex[j - a] = (nex[j - a] + dp[j]) % M;
nex[j + b] = (nex[j + b] + dp[j]) % M;
nex[j - b] = (nex[j - b] + dp[j]) % M;
nex[j + c] = (nex[j + c] + dp[j]) % M;
nex[j - c] = (nex[j - c] + dp[j]) % M;
}
}
dp = nex;
}
int ans = 0;
for (int i = s + d; i <= s + e; ++i)
ans = (ans + dp[i]) % M;
cout << ans << "\n";
return 0;
}
りあん