結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー 👑 kakel-sankakel-san
提出日時 2021-06-13 14:58:35
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 814 bytes
コンパイル時間 11,003 ms
コンパイル使用メモリ 145,180 KB
実行使用メモリ 164,168 KB
最終ジャッジ日時 2023-08-24 17:59:24
合計ジャッジ時間 17,382 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
30,784 KB
testcase_01 AC 50 ms
28,496 KB
testcase_02 AC 48 ms
28,556 KB
testcase_03 AC 52 ms
29,228 KB
testcase_04 AC 52 ms
29,236 KB
testcase_05 AC 52 ms
29,124 KB
testcase_06 AC 52 ms
29,300 KB
testcase_07 AC 52 ms
29,380 KB
testcase_08 AC 52 ms
31,204 KB
testcase_09 AC 51 ms
29,216 KB
testcase_10 AC 51 ms
29,148 KB
testcase_11 AC 52 ms
31,272 KB
testcase_12 AC 52 ms
29,100 KB
testcase_13 AC 50 ms
29,080 KB
testcase_14 AC 52 ms
29,312 KB
testcase_15 AC 52 ms
29,560 KB
testcase_16 AC 52 ms
29,128 KB
testcase_17 AC 52 ms
29,008 KB
testcase_18 AC 50 ms
28,984 KB
testcase_19 AC 51 ms
29,176 KB
testcase_20 AC 51 ms
31,240 KB
testcase_21 AC 50 ms
29,032 KB
testcase_22 AC 50 ms
29,012 KB
testcase_23 AC 51 ms
29,476 KB
testcase_24 AC 51 ms
29,552 KB
testcase_25 AC 51 ms
29,672 KB
testcase_26 AC 51 ms
29,692 KB
testcase_27 AC 52 ms
29,396 KB
testcase_28 AC 51 ms
29,500 KB
testcase_29 AC 51 ms
29,692 KB
testcase_30 AC 53 ms
29,400 KB
testcase_31 AC 52 ms
29,428 KB
testcase_32 AC 52 ms
29,576 KB
testcase_33 AC 51 ms
29,140 KB
testcase_34 AC 50 ms
28,752 KB
testcase_35 AC 51 ms
28,852 KB
testcase_36 AC 50 ms
29,224 KB
testcase_37 AC 52 ms
29,156 KB
testcase_38 AC 220 ms
29,612 KB
testcase_39 AC 220 ms
29,460 KB
testcase_40 AC 220 ms
29,484 KB
testcase_41 AC 221 ms
29,544 KB
testcase_42 AC 218 ms
29,460 KB
testcase_43 AC 211 ms
29,484 KB
testcase_44 AC 212 ms
29,360 KB
testcase_45 AC 218 ms
29,340 KB
testcase_46 AC 213 ms
29,476 KB
testcase_47 AC 215 ms
164,168 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 124 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;

class yc299
{
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NMap(int n) => Enumerable.Repeat<int>(0, n).Select(_ => NList).ToArray();
    static void Main()
    {
        var c = NList;
        var a = NList;
        var b = NList;
        var max = a.Length * b.Length / GCD(a.Length, b.Length);
        for (var i = 0; i < max; ++i)
        {
            if (a[i % a.Length] == b[i % b.Length])
            {
                WriteLine(i + 1);
                return;
            }
        }
        WriteLine(-1);
    }
    static int GCD(int a, int b)
    {
        if (a < b) return GCD(b, a);
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }
}
0