結果
問題 | No.1732 ~サンプルはちゃんと見て!~ 16進数と8進数(2) |
ユーザー | Kude |
提出日時 | 2021-11-05 22:37:42 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,567 bytes |
コンパイル時間 | 2,012 ms |
コンパイル使用メモリ | 214,816 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-04-24 06:29:04 |
合計ジャッジ時間 | 2,605 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
ソースコード
#include<bits/stdc++.h> namespace { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #include<atcoder/all> #pragma GCC diagnostic pop using namespace std; using namespace atcoder; #define rep(i,n)for (int i = 0; i < int(n); ++i) #define rrep(i,n)for (int i = int(n)-1; i >= 0; --i) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() template<class T> void chmax(T& a, const T& b) { a = max(a, b); } template<class T> void chmin(T& a, const T& b) { a = min(a, b); } using ll = long long; using P = pair<int,int>; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<ll>; using VVL = vector<VL>; } int main() { ios::sync_with_stdio(false); cin.tie(0); // string s[1 << 8]; // for(ll i = 10; i < 16; i++) // for(ll j = 10; j < 16; j++) // for(ll k = 10; k < 16; k++) { // ll x = i << 8 | j << 4 | k; // int hist[8] = {}; // while(x) { // hist[x % 8]++; // x /= 8; // } // int b = 0; // rep(i, 8) if (hist[i]) b |= 1 << i; // s[b] = string(1, char('A' + i - 10)) + string(1, char('A' + j - 10)) + string(1, char('A' + k - 10)); // cout << char('A' + i - 10) << char('A' + j - 10) << char('A' + k - 10) << ' '; // rep(i, 8) cout << hist[i] << " \n"[i + 1 == 8]; // } // for(ll i = 10; i < 16; i++) // for(ll j = 10; j < 16; j++) { // ll x = i << 4 | j; // int hist[8] = {}; // while(x) { // hist[x % 8]++; // x /= 8; // } // int b = 0; // rep(i, 8) if (hist[i]) b |= 1 << i; // string t = s[0xFE ^ b]; // if (!t.empty() && __builtin_popcount(b) == 3) { // cout << t << ' ' << i << ' ' << j << endl; // exit(0); // } // cout << char('A' + i - 10) << char('A' + j - 10) << ' '; // rep(i, 8) cout << hist[i] << " \n"[i + 1 == 8]; // } int tt; cin >> tt; while(tt--) { int n; cin >> n; int q = n / 3, r = n % 3; if (r == 0) { if (q % 7) { cout << -1 << '\n'; } else { int qq = q / 7; rep(_, qq) cout << "ACCACCCCCCCCABACAAFFE"; cout << '\n'; } } else if (r == 1) { if (q % 7 != 3) { cout << -1 << '\n'; } else { int qq = q / 7; cout << "BBCCCFACAC"; rep(_, qq) cout << "ACCACCCCCCCCABACAAFFE"; cout << '\n'; } } else { if (q % 7 != 1) { cout << -1 << '\n'; } else { int qq = q / 7; cout << "ABDCC"; rep(_, qq) cout << "ACCACCCCCCCCABACAAFFE"; cout << '\n'; } } } }