# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82061 | heon | Tavan (COCI16_tavan) | C++11 | 3 ms | 1064 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,m,k,x;
cin >> n >> m >> k >> x;
string s;
cin >> s;
vector <string> v(m);
for(int i = 0; i < m; i++){
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
int curr = 0, ind = 0;
vector <char> rj;
for(int i = 0; i < m; i++){
while(curr < x){
curr += max(1,(m - i - 1) * k);
if(curr >= x){
rj.push_back(v[i][ind]);
ind = 0;
}
else ind++;
}
curr -= (m - i - 1) * k;
}
for(auto x : s) (x == '#') ? cout << rj[ind++] : cout << x;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |