結果
| 問題 | No.862 XORでX |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-09 21:12:02 |
| 言語 | C# (.NET 10.0.201) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,617 bytes |
| 記録 | |
| コンパイル時間 | 12,387 ms |
| コンパイル使用メモリ | 175,644 KB |
| 実行使用メモリ | 225,512 KB |
| 最終ジャッジ日時 | 2026-04-09 21:12:27 |
| 合計ジャッジ時間 | 21,211 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 8 WA * 20 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (126 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.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 c = NList;
var (n, x) = (c[0] + 1, c[1]);
var list = new List<Info> { new Info (0, 100006, n) };
var width = 65536;
while (width > 0)
{
var nlist = new List<Info>();
foreach (var li in list)
{
nlist.Add(new Info(li.L, li.L + width ));
nlist.Add(new Info(li.L + width, li.R ));
}
var xe = x / width % 2;
var ue = 0;
for (var i = 0; i < list.Count; ++i)
{
if (list[i].U == list[i].R - list[i].L)
{
nlist[i * 2].U = nlist[i * 2].R - nlist[i * 2].L;
nlist[i * 2 + 1].U = nlist[i * 2 + 1].R - nlist[i * 2 + 1].L;
ue += nlist[i * 2 + 1].U;
}
else
{
nlist[i * 2].U = Math.Min(nlist[i * 2].R - nlist[i * 2].L, list[i].U);
nlist[i * 2 + 1].U = list[i].U - nlist[i * 2].U;
ue += nlist[i * 2 + 1].U;
}
}
ue %= 2;
if (xe != ue)
{
for (var i = nlist.Count - 1; i >= 0; i -= 2)
{
if (nlist[i].U > 0 && nlist[i - 1].R - nlist[i - 1].L > nlist[i - 1].U)
{
--nlist[i].U;
++nlist[i - 1].U;
break;
}
else if (nlist[i - 1].U > 0 && nlist[i].R - nlist[i].L > nlist[i].U)
{
--nlist[i - 1].U;
++nlist[i].U;
break;
}
}
}
list = nlist;
width >>= 1;
}
WriteLine(string.Join("\n", list.Where(li => li.L > 0 && li.U == 1).Select(li => li.L)));
}
class Info
{
public int L;
public int R;
public int U;
public Info(int l, int r, int u = 0)
{
L = l; R = r; U = u;
}
}
}