답안 #473264

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473264 2021-09-15T11:05:40 Z Ahmed57 ZigZag (COCI17_zigzag) C++14
80 / 80
67 ms 11148 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    int po[300]={0};
    vector<string> v(n);
    for(int i = 0;i<n;i++)cin>>v[i];
    map<char,vector<string>> mp;
    for(int i = 0;i<n;i++){
        mp[v[i][0]].push_back(v[i]);
    }for(int i = 0;i<26;i++){
        char q = ('a')+i;
        sort(mp[q].begin(),mp[q].end());
    }
    for(int i = 0;i<m;i++){
        char z;cin>>z;
        int q=z;
        int e = (po[q]%mp[z].size());
        cout<<mp[z][e]<<"\n";
        po[q]++;
    }
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 67 ms 11076 KB Output is correct
8 Correct 66 ms 11080 KB Output is correct
9 Correct 64 ms 11148 KB Output is correct
10 Correct 64 ms 11108 KB Output is correct