Submission #44498550
Source Code Expand
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,s,e) for(ll i=s;i<=e;++i)
#define FFOR(i,s,e) for(ll i=s;i>=e;--i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define ALL(a) (a).begin(),(a).end()
#define mp make_pair
#define pb push_back
#define vl vector<ll>
#define vs vector<string>
#define so(a) sort(a.begin(),a.end())
#define fi first
#define se second
#define print(a) cout<<a<<endl
#define ssize(a) (ll)(a.size())
#define MAX_N 1002
#define i197 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1000000000000000001;
struct edge
{
int to, cost;
};
struct pos{
// 1 変数を入れる;
ll t;
ll x,y;
set<ll> st;
};
int dx[4] = { 1, 0, -1, 0};
int dy[4] = { 0, 1, 0, -1};
int dd[5] = { 0, 1, 0, -1, 0};
typedef pair<ll, ll> P2;
typedef pair<pair<ll,ll>,ll> P3;
typedef pair<string,ll> Ps;
typedef pair<pair<ll,ll>,pair<ll,ll> > P4;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
ll n,m;
cin>>n>>m;
string s;
cin>>s;
vl c(n);
vector<char> d(m+1);
rep(i,n){
cin>>c[i];
d[c[i]]=s[i];
}
string ans;
rep(i,n){
ans+=d[c[i]];
d[c[i]]=s[i];
}
print(ans);
return 0;
}
Submission Info
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
300 / 300 |
| Status |
|
|
| Set Name |
Test Cases |
| 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, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, example0.txt, example1.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 000.txt |
AC |
1 ms |
3356 KiB |
| 001.txt |
AC |
8 ms |
5344 KiB |
| 002.txt |
AC |
12 ms |
5552 KiB |
| 003.txt |
AC |
8 ms |
5308 KiB |
| 004.txt |
AC |
10 ms |
5428 KiB |
| 005.txt |
AC |
11 ms |
5256 KiB |
| 006.txt |
AC |
3 ms |
3624 KiB |
| 007.txt |
AC |
4 ms |
4084 KiB |
| 008.txt |
AC |
5 ms |
4232 KiB |
| 009.txt |
AC |
12 ms |
5436 KiB |
| 010.txt |
AC |
10 ms |
5328 KiB |
| 011.txt |
AC |
9 ms |
5344 KiB |
| 012.txt |
AC |
9 ms |
5252 KiB |
| 013.txt |
AC |
9 ms |
5324 KiB |
| 014.txt |
AC |
9 ms |
5324 KiB |
| 015.txt |
AC |
8 ms |
5400 KiB |
| 016.txt |
AC |
9 ms |
5368 KiB |
| 017.txt |
AC |
8 ms |
5352 KiB |
| 018.txt |
AC |
7 ms |
5324 KiB |
| 019.txt |
AC |
8 ms |
5252 KiB |
| 020.txt |
AC |
8 ms |
5304 KiB |
| 021.txt |
AC |
8 ms |
5352 KiB |
| 022.txt |
AC |
7 ms |
5396 KiB |
| 023.txt |
AC |
8 ms |
5180 KiB |
| 024.txt |
AC |
8 ms |
5304 KiB |
| 025.txt |
AC |
8 ms |
5340 KiB |
| 026.txt |
AC |
8 ms |
5336 KiB |
| example0.txt |
AC |
1 ms |
3496 KiB |
| example1.txt |
AC |
1 ms |
3496 KiB |