結果
| 問題 |
No.398 ハーフパイプ(2)
|
| コンテスト | |
| ユーザー |
りあん
|
| 提出日時 | 2016-07-14 15:18:06 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,527 bytes |
| コンパイル時間 | 3,580 ms |
| コンパイル使用メモリ | 104,704 KB |
| 実行使用メモリ | 30,560 KB |
| 最終ジャッジ日時 | 2024-06-27 14:24:30 |
| 合計ジャッジ時間 | 24,120 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 11 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class Program
{
static void Main()
{
var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
var s = Console.ReadLine();
if (s != s.Trim())
{
Console.WriteLine("unexpected spase");
return;
}
var x = double.Parse(s) * 4 + 1e-9;
int sum = (int)x;
if (x - sum > 1e-7)
{
Console.WriteLine("unexpected input");
return;
}
long ans = 0;
for (int i = 0; i < 101; i++)
{
if (i * 4 > sum) continue;
for (int j = i; j < 101; j++)
{
if (j * 4 < sum) continue;
int lim = j - i;
int limsum = sum + j - i * 5;
var dp = new long[limsum + 1][];
for (int k = 0; k <= limsum; k++)
{
dp[k] = new long[4];
}
dp[0][0] = 1;
for (int k = 0; k < 6; k++)
{
var next = new long[limsum + 1][];
for (int l = 0; l <= limsum; l++)
{
next[l] = new long[4];
}
for (int l = 0; l <= limsum; l++)
{
if (lim == 0)
{
next[l][3] += dp[l][0] + dp[l][1] + dp[l][2] + dp[l][3];
}
else
{
next[l][1] += dp[l][0] + dp[l][1];
next[l][3] += dp[l][2] + dp[l][3];
if (l >= lim)
{
next[l][2] += dp[l - lim][0] + dp[l - lim][2];
next[l][3] += dp[l - lim][1] + dp[l - lim][3];
}
}
for (int m = 1; m < lim && m <= l; m++)
{
for (int p = 0; p < 4; p++)
{
next[l][p] += dp[l - m][p];
}
}
}
dp = next;
}
ans += dp[limsum][3];
}
}
sw.WriteLine(ans);
sw.Flush();
}
}
りあん