結果

問題 No.2947 Sing a Song
コンテスト
ユーザー Today03
提出日時 2024-10-25 21:36:19
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 72 ms / 2,000 ms
+ 145µs
コード長 652 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,123 ms
コンパイル使用メモリ 340,480 KB
実行使用メモリ 9,848 KB
最終ジャッジ日時 2026-11-01 19:52:10
合計ジャッジ時間 5,564 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;

int main() {
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    int s = ssize(S), t = ssize(T);

    for (int i = 0; i < N; i++) {
        for (int j = A[i] / s; j >= 0; j--) {
            int rem = A[i] - j * s;
            if (rem % t == 0) {
                int k = rem / t;
                while (j--) cout << S << ' ';
                while (k--) cout << T << ' ';
                cout << endl;
                break;
            }
        }
    }
}
0