# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
740269 | mzv | Tavan (COCI16_tavan) | C++17 | 1 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ccd ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
using namespace std;
/* ------------------------ hi lol ------------------------ */
ll n,m,k,x,cur=1,xm=1,z=0;
string words[501],s;
vector<int>idx;
int main() {
ccd
cin >> n >> m >> k >> x;
cin >> s;
for (int i=1;i<=m;i++) {
cin >> words[i];
sort(words[i].begin(),words[i].end());
}
while (xm*k<x) {
xm*=k;
cur++;
}
// cout << cur << endl;
while (cur>=1) {
if (x%xm!=0) {
idx.push_back((x/xm)+1);
}
else {
idx.push_back((x/xm));
}
while (x>xm) {
x-=xm;
}
xm/=k;
cur--;
}
while (idx.size()<m) {
idx.push_back(1);
}
// for (auto i : idx) {
// cout << i << " ";
// } cout << endl;
cur=1;
for (int i=0;i<n;i++) {
if (s[i]=='#') {
cout << words[cur][(idx.at(z)-1)];
z++;
cur++;
}
else {
cout << s[i];
}
}
}
// pake modular nyari alphabetical order
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |