結果
問題 | No.3135 AAABC |
ユーザー |
![]() |
提出日時 | 2025-05-02 21:45:42 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 325 ms / 2,000 ms |
コード長 | 574 bytes |
コンパイル時間 | 5,599 ms |
コンパイル使用メモリ | 332,336 KB |
実行使用メモリ | 19,924 KB |
最終ジャッジ日時 | 2025-05-02 21:45:51 |
合計ジャッジ時間 | 8,339 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; using mint = modint998244353; int main() { int N; cin >> N; string S(N, '*'); vector<string> v; auto dfs = [&](auto dfs, int i) -> void { if(i == N) { int f = 0; for(char c : S) f |= 1 << (c - 'A'); if(f == 7) v.push_back(S); }else { for(char c : "ABC") { S[i] = c; dfs(dfs, i + 1); } } }; dfs(dfs, 0); int p; cin >> p; cout << (p <= (int)v.size() ? v[p - 1] : "-1") << endl; }