# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
97826 | dalgerok | ZigZag (COCI17_zigzag) | C++17 | 193 ms | 12536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int k, n;
cin >> k >> n;
multiset < pair < int, string > > q[26];
for(int i = 1; i <= k; i++){
string s;
cin >> s;
q[s[0] - 'a'].insert(make_pair(0, s));
}
while(n--){
char c;
cin >> c;
auto it = *q[c - 'a'].begin();
cout << it.second << "\n";
q[c - 'a'].erase(q[c - 'a'].find(it));
it.first += 1;
q[c - 'a'].insert(it);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |