제출 #82061

#제출 시각아이디문제언어결과실행 시간메모리
82061heonTavan (COCI16_tavan)C++11
48 / 80
3 ms1064 KiB
#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 timeMemoryGrader output
Fetching results...