Submission #475310

# Submission time Handle Problem Language Result Execution time Memory
475310 2021-09-21T20:22:38 Z Beboo44 ZigZag (COCI17_zigzag) C++14
0 / 80
2000 ms 10288 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;
   vector<vector<string>>v(26);
   string s;
   vector<string>t;
   for(int i=0; i<n; ++i){
    cin>>s;
    t.push_back(s);
   }
   sort(t.begin(),t.end());

    for(int i=0; i<n; ++i){
        int x = (int)t[i][0]-'a';
        v[x].push_back(t[i]);
    }

   char y;
    for(int i=0; i<n; ++i){
      cin>>y;
      ll f = (int)y-'a';
      cout<<v[f][0]<<"\n";
      v[f].push_back(v[f][0]);
      v[f].erase(v[f].begin());

    }





    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 0 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 2082 ms 10276 KB Time limit exceeded
8 Execution timed out 2081 ms 10284 KB Time limit exceeded
9 Execution timed out 2091 ms 10284 KB Time limit exceeded
10 Execution timed out 2089 ms 10288 KB Time limit exceeded