답안 #381391

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381391 2021-03-25T07:19:51 Z abzal028 ZigZag (COCI17_zigzag) C++14
8 / 80
323 ms 6420 KB
#include<bits/stdc++.h>
using namespace std;
int n,k;
vector<string>str[30];
long long cnt[100007];
int main()
{
	cin>>k >>n;
	string s;
	for(int i=0;i<k;i++)
	{
		cin>>s;
 
		str[s[0]-'a'].push_back(s);
	}
	for(int i=0;i<30;i++)
	{
		sort(str[i].begin(),str[i].end());
	}
	char c;
	for(int i=0;i<n;i++)
	{
		cin>>c;
		int st=cnt[c-'a'] % (str[c-'a'].size());
		cout << str[c-'a'][st]<<endl;
		cnt[st-'a']++;
	}
 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 2 ms 364 KB Output isn't correct
4 Incorrect 2 ms 364 KB Output isn't correct
5 Incorrect 2 ms 364 KB Output isn't correct
6 Incorrect 3 ms 364 KB Output isn't correct
7 Incorrect 321 ms 6252 KB Output isn't correct
8 Incorrect 318 ms 6252 KB Output isn't correct
9 Incorrect 318 ms 6380 KB Output isn't correct
10 Incorrect 323 ms 6420 KB Output isn't correct