답안 #80007

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
80007 2018-10-18T07:21:42 Z pzdba ZigZag (COCI17_zigzag) C++14
80 / 80
242 ms 13064 KB
#include <bits/stdc++.h>
using namespace std;
vector<string> v[26];
int idx[26];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int k, n;
	cin >> k >> n;
	for(int i=1;i<=k;i++){
		string s;
		cin >> s;
		v[s[0]-'a'].emplace_back(s);
	}
	for(int i=0;i<26;i++) sort(v[i].begin(), v[i].end());
	for(int i=1;i<=n;i++){
		char s[2];
		cin >> s;
		int x = s[0]-'a';
		cout << v[x][idx[x]] << endl;
		idx[x] = (idx[x]+1)%v[x].size();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 456 KB Output is correct
4 Correct 3 ms 668 KB Output is correct
5 Correct 3 ms 668 KB Output is correct
6 Correct 3 ms 668 KB Output is correct
7 Correct 234 ms 8124 KB Output is correct
8 Correct 242 ms 9832 KB Output is correct
9 Correct 238 ms 11456 KB Output is correct
10 Correct 237 ms 13064 KB Output is correct