# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
712575 | 2023-03-19T07:39:36 Z | gnhmhp | Tavan (COCI16_tavan) | C++14 | 1 ms | 360 KB |
#include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr) using namespace std; const int maxn=1e3+5; int n, m, k; long long x; string s[maxn]; vector<int> v; int main() { fastio; cin >> n >> m >> k >> x; cin >> s[0]; v.push_back(0); for (int i=0; i<s[0].size(); ++i) if (s[0][i]=='#') v.push_back(i); for (int i=1; i<=m; ++i) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } for (int i=1; i<=m && x; ++i) { long long cur=1; for (int j=m; j>i && cur<x; --j) cur*=1LL*k; long long p=(x-1)/cur; x-=(cur*p); s[0][v[i]]=s[i][p]; } cout << s[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 356 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 360 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |