Submission #1025779

# Submission time Handle Problem Language Result Execution time Memory
1025779 2024-07-17T10:00:42 Z vjudge1 ZigZag (COCI17_zigzag) C++17
80 / 80
231 ms 12456 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n,q;
	cin>>n>>q;
	set<pair<int,string>> wor[26];
	for (int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		wor[s[0]-'a'].insert({0,s});
	}
	while (q--)
	{
		char c;
		cin>>c;
		auto p=*wor[c-'a'].begin();
		cout<<p.second<<endl;
		wor[c-'a'].erase(p);
		p.first++;
		wor[c-'a'].insert(p);
	}
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 210 ms 12220 KB Output is correct
8 Correct 218 ms 12456 KB Output is correct
9 Correct 219 ms 12368 KB Output is correct
10 Correct 231 ms 12276 KB Output is correct