結果
| 問題 |
No.3126 Dual Query Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-25 21:41:40 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 196 ms / 2,000 ms |
| コード長 | 1,145 bytes |
| コンパイル時間 | 13,598 ms |
| コンパイル使用メモリ | 170,452 KB |
| 実行使用メモリ | 188,800 KB |
| 最終ジャッジ日時 | 2025-06-20 02:43:00 |
| 合計ジャッジ時間 | 24,336 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (115 ミリ秒)。 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[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => int.Parse(ReadLine())).ToArray();
public static void Main()
{
Solve();
}
static void Solve()
{
var c = NList;
var (n, q) = (c[0], c[1]);
var x = LList(n);
var dic = new Dictionary<int, int>();
var ans = new List<string>();
var pos = 1;
for (var i = 0; i < n; ++i)
{
if (!dic.ContainsKey(x[i]))
{
ans.Add($"1 {pos} {x[i]}");
dic[x[i]] = pos;
++pos;
}
ans.Add($"2 {dic[x[i]]}");
}
if (ans.Count > q)
{
WriteLine("No");
return;
}
WriteLine("Yes");
while (ans.Count < q) ans.Add($"1 1 1");
WriteLine(string.Join("\n", ans));
}
}