結果

問題 No.3000 Optimal Run Length Encoding
ユーザー qwewe
提出日時 2025-05-14 13:21:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,505 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 71,364 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-05-14 13:22:47
合計ジャッジ時間 13,061 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 142
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <ios> // Required for std::ios_base

int main() {
    // Faster I/O
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    // Mapping from ciphertext char index (0='a', 1='b', ...) to plaintext char
    char mapping[26];
    mapping['a' - 'a'] = 'c';
    mapping['b' - 'a'] = 'q';
    mapping['c' - 'a'] = 'l';
    mapping['d' - 'a'] = 'm';
    mapping['e' - 'a'] = 'd';
    mapping['f' - 'a'] = 'r';
    mapping['g' - 'a'] = 's';
    mapping['h' - 'a'] = 't';
    mapping['i' - 'a'] = 'f';
    mapping['j' - 'a'] = 'x';
    mapping['k' - 'a'] = 'y';
    mapping['l' - 'a'] = 'z';
    mapping['m' - 'a'] = 'b';
    mapping['n' - 'a'] = 'a';
    mapping['o' - 'a'] = 'n';
    mapping['p' - 'a'] = 'o';
    mapping['q' - 'a'] = 'p';
    mapping['r' - 'a'] = 'u';
    mapping['s' - 'a'] = 'v';
    mapping['t' - 'a'] = 'w';
    mapping['u' - 'a'] = 'e';
    mapping['v' - 'a'] = 'g';
    mapping['w' - 'a'] = 'h';
    mapping['x' - 'a'] = 'i';
    mapping['y' - 'a'] = 'j';
    mapping['z' - 'a'] = 'k';

    std::string ciphertext;
    std::cin >> ciphertext;

    std::string plaintext = "";
    // Reserve space for efficiency, though not strictly necessary for length 30
    plaintext.reserve(ciphertext.length());

    for (char c : ciphertext) {
        plaintext += mapping[c - 'a']; // Look up the mapping
    }

    std::cout << plaintext << "\n"; // Use "\n" for newline, often faster than std::endl

    return 0;
}
0