結果
| 問題 |
No.3135 AAABC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-02 21:55:55 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 232 ms / 2,000 ms |
| コード長 | 1,050 bytes |
| コンパイル時間 | 4,008 ms |
| コンパイル使用メモリ | 286,764 KB |
| 実行使用メモリ | 19,920 KB |
| 最終ジャッジ日時 | 2025-05-02 21:56:01 |
| 合計ジャッジ時間 | 5,618 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i >= n; i--)
#define inr(l, x, r) (l <= x && x < r)
#define ll long long
#define ld long double
// using mint = modint1000000007;
// using mint = modint998244353;
constexpr int IINF = 1001001001;
constexpr ll INF = 1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
int main(){
int n, s; cin >> n >> s;
s--;
vector<string> cand;
int lim = 1;
rep(i, 0, n) lim *= 3;
rep(i, 0, lim){
int tmp = i;
string t;
vector<int> cnt(3);
rep(j, 0, n){
cnt[tmp%3]++;
t += (char)('A'+tmp%3);
tmp /= 3;
}
if(cnt[0] && cnt[1] && cnt[2]) cand.push_back(t);
}
sort(cand.begin(), cand.end());
if(cand.size() <= s) cout << -1 << endl;
else cout << cand[s] << endl;
return 0;
}