結果

問題 No.501 穴と文字列
ユーザー hiyokko2hiyokko2
提出日時 2017-08-03 22:13:35
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 632 bytes
コンパイル時間 2,371 ms
コンパイル使用メモリ 150,956 KB
実行使用メモリ 811,408 KB
最終ジャッジ日時 2023-08-21 07:25:08
合計ジャッジ時間 12,637 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 AC 1 ms
4,372 KB
testcase_03 AC 1 ms
4,372 KB
testcase_04 AC 1 ms
4,372 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,372 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,372 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,372 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 589 ms
217,864 KB
testcase_21 AC 1,088 ms
391,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
const int INF = 1e9;



signed main()
{
    int N, D;

    cin >> N >> D;

    set<string> ans;
    for (int C=0; C<=N; C++) {
        int A = N - D + C;
        int B = D - 2 * C;

        if (A < 0 || B < 0) continue;

        string kouho = "";
        REP(i,B) kouho += 'A';
        REP(i,C) kouho += 'B';
        REP(i,A) kouho += 'C';

        ans.insert(kouho);
    }

    cout << *ans.begin() << endl;
}
0