結果
| 問題 | No.612 Move on grid |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-10-31 00:13:10 |
| 言語 | C# (.NET 10.0.403 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 114 ms / 2,500 ms |
| + 784µs | |
| コード長 | 1,523 bytes |
| 記録 | |
| コンパイル時間 | 7,302 ms |
| コンパイル使用メモリ | 171,356 KB |
| 実行使用メモリ | 34,176 KB |
| 最終ジャッジ日時 | 2026-10-31 00:13:29 |
| 合計ジャッジ時間 | 11,444 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (278 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
using AtCoder;
class Program
{
static int NN => int.Parse(ReadLine());
static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();
public static void Main()
{
Solve();
}
static void Solve()
{
var t = NN;
var s = NList;
var a = Math.Abs(s[0]);
var b = Math.Abs(s[1]);
var c = Math.Abs(s[2]);
var dp = new long[20001];
var ndp = new long[20001];
var mod = 1_000_000_007;
var offset = 10000;
dp[offset] = 1;
for (var i = 0; i < t; ++i)
{
for (var j = 0; j < ndp.Length; ++j) ndp[j] = 0;
for (var j = 0; j < dp.Length; ++j)
{
if (j - a >= 0) ndp[j - a] += dp[j];
if (j - b >= 0) ndp[j - b] += dp[j];
if (j - c >= 0) ndp[j - c] += dp[j];
if (j + a < ndp.Length) ndp[j + a] += dp[j];
if (j + b < ndp.Length) ndp[j + b] += dp[j];
if (j + c < ndp.Length) ndp[j + c] += dp[j];
}
for (var j = 0; j < ndp.Length; ++j) dp[j] = ndp[j] % mod;
}
var ans = 0L;
for (var i = s[3] + offset; i <= s[4] + offset; ++i) ans = (ans + dp[i]) % mod;
WriteLine(ans);
}
}