답안 #443160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
443160 2021-07-09T23:37:15 Z penguinhacker Tavan (COCI16_tavan) C++14
80 / 80
1 ms 332 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

int n, m, k, x;
string s, cand[500];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m >> k >> x >> s, --x;
	vector<int> d;
	for (int i=0; i<m; ++i) {
		cin >> cand[i];
		sort(cand[i].begin(), cand[i].end());
		d.push_back(x%k);
		x/=k;
	}
	reverse(d.begin(), d.end());
	int seen=0;
	for (int i=0; i<n; ++i)
		if (s[i]=='#')
			s[i]=cand[seen][d[seen]], ++seen;
	cout << s;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct