結果
| 問題 |
No.3135 AAABC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-02 22:33:21 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 2,000 ms |
| コード長 | 1,003 bytes |
| コンパイル時間 | 8,782 ms |
| コンパイル使用メモリ | 171,688 KB |
| 実行使用メモリ | 213,692 KB |
| 最終ジャッジ日時 | 2025-05-02 22:33:33 |
| 合計ジャッジ時間 | 12,373 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 32 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (117 ミリ秒)。 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 n = NN;
var s = NN;
var bitmax = (int)Math.Pow(3, n);
for (var b = 0; b < bitmax; ++b)
{
var tmp = b;
var count = new int[3];
var str = new char[n];
for (var i = 0; i < n; ++i)
{
++count[tmp % 3];
str[n - i - 1] = (char)('A' + tmp % 3);
tmp /= 3;
}
if (count[0] > 0 && count[1] > 0 && count[2] > 0) --s;
if (s == 0)
{
WriteLine(string.Concat(str));
return;
}
}
WriteLine(-1);
}
}