Submission #381420

#TimeUsernameProblemLanguageResultExecution timeMemory
381420asqarZigZag (COCI17_zigzag)C++14
80 / 80
338 ms6532 KiB
#include <bits/stdc++.h> using namespace std; vector < string > v[30]; string s; int n, k, id[30]; char c; main () { cin >> k >> n; for(int i = 0; i < k; i ++) { cin >> s; v[s[0] - 'a'].push_back (s); } for(int i = 0; i < 30; i ++) { sort(v[i].begin (), v[i].end ()); } while (n --) { cin >> c; int x = c - 'a'; cout << v[x][id[x]] << "\n"; id[x] ++; id[x] %= v[x].size (); } }

Compilation message (stderr)

zigzag.cpp:7:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main ()
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...