Submission #153758

# Submission time Handle Problem Language Result Execution time Memory
153758 2019-09-15T20:14:18 Z BabinSinko Tavan (COCI16_tavan) C++14
48 / 80
3 ms 504 KB
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <string.h>
#include <algorithm>

using namespace std;

long long n, m, k, x, nm, a, l;
string s, sc;
char c[503][29];
int main(){
cin >> n >> m >> k >> x;
cin >> s;
for (int i = 0; i < m; i++){
	cin >> sc;
	strcpy(c[i], sc.c_str());
	sort(c[i], c[i] + k);
}
a = x;
l = s.length();
for (int i = 0; i < l; i++){
	if (s[i] == '#'){
		s[i] = c[nm][(a % (k + 1)) - 1];
		a = a / (k+1);
		nm = nm + 1;
	}
}
cout << s;
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Incorrect 2 ms 256 KB Output isn't correct
8 Incorrect 3 ms 376 KB Output isn't correct
9 Incorrect 3 ms 376 KB Output isn't correct
10 Incorrect 3 ms 376 KB Output isn't correct