提出 #44544477


ソースコード 拡げる

#include <bits/stdc++.h>

void solve(std::istream& is, std::ostream& os) {
    using Num = long long int;
    Num n {0};
    std::string s;
    Num q {0};
    is >> n >> s >> q;

    std::vector<Num> gen(n+2, 0);
    std::string cs;
    cs.resize(n);
    Num to_lower {-1};
    Num to_upper {-1};

    for(decltype(q) i{0}; i<n; ++i) {
        cs.at(i) = s.at(i);
    }

    for(decltype(q) i{1}; i<=q; ++i) {
        Num t {0};
        Num x {0};
        char c {0};
        is >> t >> x >> c;
        --x;

        if (t == 1) {
            gen.at(x) = i;
            cs.at(x) = c;
        } else if(t == 2) {
            to_lower = i;
        } else if(t == 3) {
            to_upper = i;
        }
    }

    for(decltype(n) i{0}; i<n; ++i) {
        char l = static_cast<char>(std::tolower(cs.at(i)));
        char u = static_cast<char>(std::toupper(cs.at(i)));

        if ((gen.at(i) > to_lower) && (gen.at(i) > to_upper)) {
            os << cs.at(i);
        } else if ((gen.at(i) < to_lower) && (gen.at(i) > to_upper)) {
            os << l;
        } else if ((gen.at(i) > to_lower) && (gen.at(i) < to_upper)) {
            os << u;
        } else {
            if (to_lower < to_upper) {
                os << u;
            } else {
                os << l;
            }
        }
    }

    os << "\n";
    return;
}

int main(void) {
    solve(std::cin, std::cout);
    return 0;
}

提出情報

提出日時
問題 D - LOWER
ユーザ zettsut
言語 C++ 20 (gcc 12.2)
得点 400
コード長 1461 Byte
結果 AC
実行時間 212 ms
メモリ 8276 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 2
AC × 24
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 02_edge_22.txt, 02_edge_23.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3480 KiB
00_sample_01.txt AC 1 ms 3404 KiB
01_random_02.txt AC 153 ms 8092 KiB
01_random_03.txt AC 153 ms 8136 KiB
01_random_04.txt AC 153 ms 8108 KiB
01_random_05.txt AC 212 ms 8096 KiB
01_random_06.txt AC 199 ms 8108 KiB
01_random_07.txt AC 199 ms 8092 KiB
01_random_08.txt AC 119 ms 8092 KiB
01_random_09.txt AC 119 ms 8188 KiB
01_random_10.txt AC 118 ms 8276 KiB
01_random_11.txt AC 196 ms 8096 KiB
01_random_12.txt AC 196 ms 8084 KiB
01_random_13.txt AC 195 ms 8124 KiB
01_random_14.txt AC 119 ms 8100 KiB
01_random_15.txt AC 120 ms 8144 KiB
01_random_16.txt AC 118 ms 8180 KiB
01_random_17.txt AC 20 ms 6088 KiB
01_random_18.txt AC 75 ms 5580 KiB
01_random_19.txt AC 119 ms 7064 KiB
01_random_20.txt AC 21 ms 4232 KiB
01_random_21.txt AC 103 ms 7852 KiB
02_edge_22.txt AC 107 ms 3524 KiB
02_edge_23.txt AC 120 ms 8108 KiB