結果
問題 | No.2965 Don't Stop the Game again |
ユーザー | tobisatis |
提出日時 | 2024-11-16 17:47:36 |
言語 | C# (.NET 8.0.203) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,589 bytes |
コンパイル時間 | 12,950 ms |
コンパイル使用メモリ | 168,060 KB |
実行使用メモリ | 193,876 KB |
最終ジャッジ日時 | 2024-11-16 17:48:02 |
合計ジャッジ時間 | 19,586 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 55 ms
30,336 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (92 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
namespace AtCoder; #nullable enable using System.Numerics; static class Extensions { public static T[] Repeat<T>(this int time, Func<T> F) => Enumerable.Range(0, time).Select(_ => F()).ToArray(); public static int ToFlag(this int i) { if (i < 0 || 31 <= i) throw new IndexOutOfRangeException(); return 1 << i; } public static bool OfFlag(this int value, int i) => (value & ToFlag(i)) > 0; public static int WithFlag(this int value, int i, bool f) => f ? (value | ToFlag(i)) : (value & ~ToFlag(i)); } class AtCoder { object? Solve() { var n = 50; var m = Int(); var qz = n.Repeat(Int); var oi = -1; for (var i = 0; i < n; i++) if (qz[i] == 1) oi = i + 1; var si = -1; for (var i = 0; i < n; i++) if (qz[i] != 1) si = i + 1; var ops = new List<int[]>(); for (var i = 1; i <= n; i++) ops.Add(new[]{ 1, i }); var used = new HashSet<int>(){ oi, si }; var mz = new List<int>(){ si }; for (var i = 1; i <= n; i++) { if (used.Contains(i)) continue; mz.Add(i); if (mz.Count == 31) break; } var mc = mz.Count; for (var i = 1; i < mc; i++) { var lj = mz[i - 1]; var j = mz[i]; ops.Add(new[]{ 3, lj, lj, j }); } var start = -1; for (var i = 0; i < 31; i++) { if (!(m - 1).OfFlag(i)) continue; if (start < 0) { start = mz[i]; continue; } ops.Add(new[]{ 3, start, mz[i], start }); } { var nmz = new List<int>() { start }; foreach (var mv in mz) if (mv != start) nmz.Add(mv); mz = nmz; } for (var i = 1; i < mc; i++) { var lj = mz[i - 1]; var j = mz[i]; ops.Add(new[]{ 4, lj, lj, j }); } start = -1; for (var i = 0; i < 31; i++) { if (!m.OfFlag(i)) continue; if (start < 0) { start = mz[i]; continue; } ops.Add(new[]{ 4, start, mz[i], start }); } for (var i = 1; i <= n; i++) if (i != oi) ops.Add(new[] { 3, start, i, start }); Out(ops.Count); foreach (var op in ops) Out(op, " "); return null; } public static void Main() => new AtCoder().Run(); public void Run() { var res = Solve(); if (res != null) { if (res is bool yes) res = yes ? "Yes" : "No"; sw.WriteLine(res); } sw.Flush(); } string[] input = Array.Empty<string>(); int iter = 0; readonly StreamWriter sw = new(Console.OpenStandardOutput()) { AutoFlush = false }; string String() { while (iter >= input.Length) (input, iter) = (Console.ReadLine()!.Split(' '), 0); return input[iter++]; } T Input<T>() where T : IParsable<T> => T.Parse(String(), null); int Int() => Input<int>(); void Out(object? x, string? separator = null) { separator ??= Environment.NewLine; if (x is System.Collections.IEnumerable obj and not string) { var firstLine = true; foreach (var item in obj) { if (!firstLine) sw.Write(separator); firstLine = false; sw.Write(item); } } else sw.Write(x); sw.WriteLine(); } }