提出 #49421907


ソースコード 拡げる

// LUOGU_RID: 143484061
#include <bits/stdc++.h>
#define int long long
using namespace std;
string s;
int n; 
signed main(){
	cin >> s;n = s.size();
	s= ' ' + s;
	map<pair<char,int> , char> mp;
	mp[{'A',1}] = 'B',mp[{'A',2}] = 'C',mp[{'B',1}] = 'C',mp[{'B',2}] = 'A',mp[{'C',1}] = 'A',mp[{'C',2}] = 'B';
	int q;
	cin >> q;
	while(q--){
		int t,k;
		cin >> t>> k;
		stack<int> st;
		
		while(t--){
			if(k==1){
				t %= 3;
			}
			st.push(k);
			k ++ ;
			k/=2;
		}
		
		char ans=s[k];
		while(!st.empty()){
			int f=st.top();st.pop();
			if(f  != k * 2){
				ans = mp[{ans,1}];
			}else{
				ans = mp[{ans,2}];
			}k=f;
		}
		
		cout<<ans<<endl;
		
	}
	return 0;
}

提出情報

提出日時
問題 D - ABC Transform
ユーザ Expert_Dream
言語 C++ 17 (gcc 12.2)
得点 400
コード長 704 Byte
結果 AC
実行時間 248 ms
メモリ 3884 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 2
AC × 24
セット名 テストケース
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, example0.txt, example1.txt
ケース名 結果 実行時間 メモリ
000.txt AC 1 ms 3408 KiB
001.txt AC 2 ms 3748 KiB
002.txt AC 246 ms 3520 KiB
003.txt AC 248 ms 3736 KiB
004.txt AC 132 ms 3732 KiB
005.txt AC 223 ms 3696 KiB
006.txt AC 225 ms 3884 KiB
007.txt AC 222 ms 3752 KiB
008.txt AC 206 ms 3604 KiB
009.txt AC 206 ms 3476 KiB
010.txt AC 206 ms 3880 KiB
011.txt AC 207 ms 3408 KiB
012.txt AC 208 ms 3680 KiB
013.txt AC 167 ms 3468 KiB
014.txt AC 165 ms 3688 KiB
015.txt AC 168 ms 3476 KiB
016.txt AC 165 ms 3424 KiB
017.txt AC 165 ms 3756 KiB
018.txt AC 166 ms 3680 KiB
019.txt AC 168 ms 3416 KiB
020.txt AC 167 ms 3480 KiB
021.txt AC 166 ms 3656 KiB
example0.txt AC 1 ms 3668 KiB
example1.txt AC 1 ms 3464 KiB