Submission #475315

# Submission time Handle Problem Language Result Execution time Memory
475315 2021-09-21T20:28:17 Z Beboo44 ZigZag (COCI17_zigzag) C++14
0 / 80
2000 ms 10988 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0)

int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;

   ll n,m;
   cin>>n>>m;
   map<char,vector<string>>mp;
   string s;
   vector<string>t(n);
   for(int i=0; i<n; ++i){
    cin>>t[i];
    mp[t[i][0]].push_back(t[i]);
   }
   for(char i ='a'; i<'z'; ++i){
    sort(mp[i].begin(),mp[i].end());
   }
   char y;
    for(int i=0; i<n; ++i){
      cin>>y;
      cout<<mp[y][0]<<"\n";
      mp[y].push_back(mp[y][0]);
      mp[y].erase(mp[y].begin());

    }





    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Incorrect 1 ms 332 KB Output isn't correct
6 Incorrect 1 ms 332 KB Output isn't correct
7 Execution timed out 2083 ms 10864 KB Time limit exceeded
8 Execution timed out 2065 ms 10868 KB Time limit exceeded
9 Execution timed out 2074 ms 10936 KB Time limit exceeded
10 Execution timed out 2070 ms 10988 KB Time limit exceeded