# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95560 | 2019-02-02T05:26:46 Z | oolimry | Tavan (COCI16_tavan) | C++14 | 2 ms | 380 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k, x; //freopen("i.txt","r",stdin); scanf("%d %d %d %d",&n,&m,&k,&x); string s; cin >> s; string arr[m]; for(int i = 0;i < m;i++){ cin >> arr[i]; } reverse(arr, arr + m); char carr[m][k]; for(int i= 0;i < m;i++){ for(int j = 0;j < k;j++){ carr[i][j] = arr[i].at(j); } } for(int i =0;i < m;i++){ sort(carr[i], carr[i] + k); } int index = 0; x--; for(int i = n - 1;i >= 0 ;i--){ char c = s.at(i); if(c != '#'){ continue; } s[i] = carr[index][x % k]; x /= k; index++; } for(int i= 0;i < m;i++){ for(int j = 0;j < k;j++){ //printf("%c ",carr[i][j]); } // printf("\n"); } cout << s; return 0; }
Compilation message
# | 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 | 376 KB | Output is correct |
4 | Correct | 2 ms | 380 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 252 KB | Output is correct |