提出 #50584272


ソースコード 拡げる

// Author: XZC(L_Wave)
// Language: Cpp/G++14
// Problem: C - Many Replacement
// Contest: AtCoder - HUAWEI Programming Contest 2024(AtCoder Beginner Contest 342)
// URL: https://atcoder.jp/contests/abc342/tasks/abc342_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Create Time: not 2024-02-24 20:00:16, but 1926-08-17 11:45:14
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i <= i##ABRACADABRA; i++)
#define drep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i >= i##ABRACADABRA; i--)
using namespace std;
using ll = long long;

int n,q,to[29];
string s;

int main() {
  cin>>n>>s>>q;
  rep(i,1,26)to[i]=i;
  while (q--){
    char x,y;
    cin>>x>>y;
    x^=96,y^=96;
    rep(i,1,26)if (to[i]==x)to[i]=y;
  }
  rep(i,0,n-1)cout<<(char)(to[s[i]^96]^96);
  return 0;
}

提出情報

提出日時
問題 C - Many Replacement
ユーザ fft_ntt
言語 C++ 20 (gcc 12.2)
得点 350
コード長 902 Byte
結果 AC
実行時間 27 ms
メモリ 3696 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 350 / 350
結果
AC × 3
AC × 29
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_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, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3564 KiB
00_sample_01.txt AC 1 ms 3456 KiB
00_sample_02.txt AC 1 ms 3644 KiB
01_random_03.txt AC 22 ms 3504 KiB
01_random_04.txt AC 22 ms 3576 KiB
01_random_05.txt AC 23 ms 3628 KiB
01_random_06.txt AC 22 ms 3460 KiB
01_random_07.txt AC 22 ms 3624 KiB
01_random_08.txt AC 9 ms 3636 KiB
01_random_09.txt AC 8 ms 3632 KiB
01_random_10.txt AC 11 ms 3620 KiB
01_random_11.txt AC 18 ms 3620 KiB
01_random_12.txt AC 19 ms 3652 KiB
01_random_13.txt AC 23 ms 3576 KiB
01_random_14.txt AC 13 ms 3484 KiB
01_random_15.txt AC 22 ms 3568 KiB
01_random_16.txt AC 22 ms 3584 KiB
01_random_17.txt AC 22 ms 3620 KiB
01_random_18.txt AC 23 ms 3500 KiB
01_random_19.txt AC 26 ms 3584 KiB
01_random_20.txt AC 26 ms 3696 KiB
01_random_21.txt AC 27 ms 3580 KiB
01_random_22.txt AC 26 ms 3636 KiB
01_random_23.txt AC 8 ms 3512 KiB
01_random_24.txt AC 1 ms 3504 KiB
01_random_25.txt AC 2 ms 3564 KiB
01_random_26.txt AC 4 ms 3624 KiB
01_random_27.txt AC 1 ms 3500 KiB
01_random_28.txt AC 1 ms 3456 KiB