Submission #447308

#TimeUsernameProblemLanguageResultExecution timeMemory
447308dvtdZigZag (COCI17_zigzag)C++14
0 / 80
88 ms9668 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; vector<string> _list[50]; int idx[50]; int n, m; int main() { cin >> n >> m; for (int i = 0; i < n; ++i) { string tmp; cin >> tmp; idx[tmp[0] - 'a'] = 0; _list[tmp[0] - 'a'].push_back(tmp); } for (int i = 0; i <= 27; ++i) sort(_list[i].begin(),_list[i].end()); for (int i = 0; i < m; ++i) { char tmp; cin >> tmp; cout << _list[tmp - 'a'][idx[tmp]] << endl; idx[tmp] =(idx[tmp] + 1) % (int)(_list[tmp - 'a'].size()); } }

Compilation message (stderr)

zigzag.cpp: In function 'int main()':
zigzag.cpp:27:38: warning: array subscript has type 'char' [-Wchar-subscripts]
   27 |         cout << _list[tmp - 'a'][idx[tmp]] << endl;
      |                                      ^~~
zigzag.cpp:28:13: warning: array subscript has type 'char' [-Wchar-subscripts]
   28 |         idx[tmp] =(idx[tmp] + 1) % (int)(_list[tmp - 'a'].size());
      |             ^~~
zigzag.cpp:28:24: warning: array subscript has type 'char' [-Wchar-subscripts]
   28 |         idx[tmp] =(idx[tmp] + 1) % (int)(_list[tmp - 'a'].size());
      |                        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...