結果
問題 | No.3135 AAABC |
ユーザー |
|
提出日時 | 2025-05-02 21:38:50 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 982 bytes |
コンパイル時間 | 3,488 ms |
コンパイル使用メモリ | 276,824 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-05-02 21:38:54 |
合計ジャッジ時間 | 4,400 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
ソースコード
// #include <bits/allocator.h> // Temp fix for gcc13 global pragma // #pragma GCC target("avx2,bmi2,popcnt,lzcnt") // #pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> // #include <x86intrin.h> using namespace std; #if __cplusplus >= 202002L using namespace numbers; #endif #ifdef LOCAL #include "Debug.h" #else #define debug_endl() 42 #define debug(...) 42 #define debug2(...) 42 #define debug_bin(...) 42 #endif int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); int n, k; cin >> n >> k, -- k; vector<int> a(n); a[n - 2] = 1, a[n - 1] = 2; while(k --){ while(true){ ++ a[n - 1]; for(auto i = n - 1; a[i] == 3; -- i){ if(i == 0){ cout << "-1\n"; return 0; } a[i] = 0; ++ a[i - 1]; } array<bool, 3> flag{}; for(auto c: a){ flag[c] = true; } if(ranges::min(flag)){ break; } } } for(auto c: a){ cout << "ABC"[c]; } cout << "\n"; return 0; } /* */