結果
問題 |
No.3135 AAABC
|
ユーザー |
|
提出日時 | 2025-05-05 01:31:47 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 746 bytes |
コンパイル時間 | 3,703 ms |
コンパイル使用メモリ | 279,484 KB |
実行使用メモリ | 47,780 KB |
最終ジャッジ日時 | 2025-05-05 01:31:52 |
合計ジャッジ時間 | 5,477 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N, S; cin >> N >> S; vector<vector<int>> ans; vector<int> A(N); auto dfs = [&] (auto dfs, int now) -> void { if (now == N) { bool ok = true; for (int i = 0; i <= 2; i++) { ok &= find(A.begin(), A.end(), i) != A.end(); } if (ok) ans.push_back(A); } else { for (int i = 0; i <= 2; i++) { A[now] = i; dfs(dfs, now + 1); } } }; dfs(dfs, 0); S--; if (S < ans.size()) { for (int i: ans[S]) cout << (char)('A' + i); cout << endl; } else { cout << -1 << endl; } return 0; }