結果
問題 |
No.3219 Ruler to Maximize
|
ユーザー |
|
提出日時 | 2025-08-01 21:58:28 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,558 bytes |
コンパイル時間 | 8,186 ms |
コンパイル使用メモリ | 172,024 KB |
実行使用メモリ | 191,444 KB |
最終ジャッジ日時 | 2025-08-01 21:58:42 |
合計ジャッジ時間 | 11,366 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 WA * 10 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (106 ミリ秒)。 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(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var a = NList; var w = 0; var b = 0; var ans = new char[n]; var isw = true; for (var i = 12; i >= 0; --i) { var addor = 0; List<int> added; do { added = new List<int>(); for (var j = 0; j < n; ++j) { if (ans[j] == 0 && ((((a[j] >> i) & 1) != 0) || (a[j] & addor) != 0)) { if (isw) { w |= a[j]; ans[j] = 'W'; } else { b |= a[j]; ans[j] = 'B'; } added.Add(a[j]); addor |= a[j]; } } } while (added.Count > 0); if (w > 0) isw = false; } WriteLine(w * b); WriteLine(string.Concat(ans)); } }