結果

問題 No.510 二次漸化式
ユーザー masaktmasakt
提出日時 2017-04-29 00:21:50
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,546 bytes
コンパイル時間 4,587 ms
コンパイル使用メモリ 103,696 KB
実行使用メモリ 24,808 KB
最終ジャッジ日時 2023-10-11 20:48:09
合計ジャッジ時間 15,138 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
20,784 KB
testcase_01 AC 57 ms
22,808 KB
testcase_02 AC 210 ms
24,808 KB
testcase_03 AC 208 ms
22,856 KB
testcase_04 AC 190 ms
22,780 KB
testcase_05 AC 193 ms
22,728 KB
testcase_06 AC 865 ms
22,876 KB
testcase_07 AC 851 ms
24,768 KB
testcase_08 AC 1,029 ms
22,816 KB
testcase_09 AC 1,026 ms
22,728 KB
testcase_10 AC 116 ms
22,796 KB
testcase_11 AC 116 ms
22,744 KB
testcase_12 AC 118 ms
24,760 KB
testcase_13 AC 117 ms
22,852 KB
testcase_14 AC 117 ms
22,860 KB
testcase_15 AC 116 ms
22,740 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int q = int.Parse(Console.ReadLine());
            long[] x = new long[n + 1];
            long[] y = new long[n + 1];
            long[] a = new long[n + 1];
            long[] b = new long[n + 1];
            a[0] = b[0] = 1;
            int s = 0;

            string[] query = new string[3];
            for (int i = 0; i < q; i++)
            {
                query = Console.ReadLine().Split(' ');
                if (query[0] == "x")
                {
                    x[int.Parse(query[1])] = int.Parse(query[2]);
                    s = Math.Min(s, int.Parse(query[1]));
                }
                else if (query[0] == "y")
                {
                    y[int.Parse(query[1])] = int.Parse(query[2]);
                    s = Math.Min(s, int.Parse(query[1]));
                }
                else
                {
                    int l = int.Parse(query[1]);
                    for (int j = 0; j < l; j++)
                    {
                        if (s - 1 <= j)
                        {
                            a[j + 1] = (x[j] * b[j] % 1000000007L * b[j] + a[j]) % 1000000007L;
                            b[j + 1] = (y[j] * b[j] + 1) % 1000000007L;
                            s++;
                        }
                    }
                    Console.WriteLine(a[l]);
                }
            }
        }
    }
}
0