# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
79951 | luckyboy | ZigZag (COCI17_zigzag) | C++14 | 102 ms | 13312 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/** Lucky Boy **/
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define maxc 1000000007
#define maxn 1000006
#define maxm 500005
#define pii pair <int,int>
#define Task ""
using namespace std;
int n,m,top[26];
vector <string> s[26];
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//freopen(".inp", "r",stdin);
cin >> n >> m;
FOR(i,1,n)
{
string temp;
cin >> temp;
s[temp[0]-'a'].pb(temp);
}
FOR(i,0,25) sort(s[i].begin(),s[i].end());
while (m--)
{
char c;
int w;
cin >> c;
w = c - 'a';
cout << s[w][top[w]++] << '\n';
if (top[w] == s[w].size()) top[w] = 0;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |