# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
447313 | dvtd | ZigZag (COCI17_zigzag) | C++14 | 68 ms | 6336 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n, m, c[26];
vector<string> oc[26];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i=0; i < n; ++i)
{
string s;
cin >> s;
oc[s[0]-'a'].push_back(s);
}
for (int i=0; i<26; ++i)
sort(oc[i].begin(), oc[i].end());
while(m--)
{
char a;
cin >> a;
int x=a-'a';
cout << oc[x][c[x]] << "\n";
c[x]=(c[x]+1)%oc[x].size();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |