結果
問題 |
No.2929 Miracle Branch
|
ユーザー |
|
提出日時 | 2024-11-01 00:39:29 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,851 bytes |
コンパイル時間 | 11,474 ms |
コンパイル使用メモリ | 167,856 KB |
実行使用メモリ | 220,684 KB |
最終ジャッジ日時 | 2024-11-01 00:39:54 |
合計ジャッジ時間 | 21,716 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 WA * 1 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (108 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/
ソースコード
using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var x = long.Parse(ReadLine()); var prev = -1; var ans = new List<int[]>(); var color = new List<char>(); if (x == 1) { color.Add('b'); color.Add('g'); ans.Add(new int[] { 1, 2 }); } { while (x % 4 == 0) { color.Add('b'); var br = color.Count; if (prev > 0) ans.Add(new int[] { prev, br }); for (var j = 0; j < 4; ++j) { color.Add('g'); ans.Add(new int[] { br, color.Count }); } prev = br; x /= 4; } } for (var i = 2; i <= 200000; ++i) { while (x % i == 0) { color.Add('b'); var br = color.Count; if (prev > 0) ans.Add(new int[] { prev, br }); for (var j = 0; j < i; ++j) { color.Add('g'); ans.Add(new int[] { br, color.Count }); } prev = br; x /= i; } } if (x > 1 || ans.Count > 200000) { WriteLine(-1); return; } WriteLine(color.Count); WriteLine(string.Join("\n", ans.Select(ai => string.Join(" ", ai)))); WriteLine(string.Join(" ", color)); } }