結果

問題 No.2827 Enter User Name to Play
ユーザー Raihanul IslamRaihanul Islam
提出日時 2024-08-02 22:31:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 70,912 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-08-02 22:31:08
合計ジャッジ時間 1,388 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>

int main() {
    // Read the input
    int N;
    std::cin >> N;

    std::string S;
    std::cin >> S;

    std::vector<int> P(N);
    for (int i = 0; i < N; ++i) {
        std::cin >> P[i];
    }

    // Create the output string T
    std::string T(N, ' ');  // Initialize T with N spaces
    for (int i = 0; i < N; ++i) {
        T[i] = S[P[i] - 1];  // Rearrange characters based on permutation
    }

    // Output the result
    std::cout << T << std::endl;

    return 0;
}
0