# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
164362 |
2019-11-19T15:23:07 Z |
_qVp_ |
Tavan (COCI16_tavan) |
C++14 |
|
2 ms |
424 KB |
#include <bits/stdc++.h>
using namespace std;
const int md = 505;
int n, m, k, x, cnt = 1;
string s, can[md], ans[md];
void findChar(int p) {
if (p == m - 1) {
//cout << x << " " << cnt;
ans[p] = can[p][x - cnt];
return ;
}
for(int j = 0; j < k; j++) {
if (cnt + k * (m - p - 1) > x) {
ans[p] = can[p][j];
findChar(p + 1);
break;
} else cnt += k * (m - p - 1);
//cout << p << " " << cnt << endl;
}
}
int main() {
// freopen("test.in", "r", stdin);
ios_base::sync_with_stdio(0);
cin >> n >> m >> k >> x;
cin >> s;
for(int i = 0; i < m; i++) {
cin >> can[i];
sort(can[i].begin(), can[i].end());
}
findChar(0);
int pos = 0;
for(int i = 0; i < n; i++) {
if (s[i] == '#') {
cout << ans[pos++];
} else cout << s[i];
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
424 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |