Submission #153773

#TimeUsernameProblemLanguageResultExecution timeMemory
153773BabinSinkoTavan (COCI16_tavan)C++14
48 / 80
3 ms504 KiB
#include <cstdio> #include <cstdlib> #include <cmath> #include <iostream> #include <cctype> #include <ctime> #include <string.h> #include <algorithm> #include <vector> using namespace std; long long n, m, k, x, nm, a, l; vector<long long> key; string s, sc; char c[503][29]; int main(){ cin >> n >> m >> k >> x; cin >> s; a = x; for (int i = 0; i < m; i++){ cin >> sc; strcpy(c[i], sc.c_str()); sort(c[i], c[i] + k); if (a != 0){ key.push_back ((a % (k + 1)) - 1); a = a / (k+1); } if (a == 0){ key.push_back (0); } } for (int i = 0; i < n; i++){ if (s[i] == '#'){ s[i] = c[nm][key[nm]]; nm = nm + 1; } } cout << s; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...