Submission #473626

#TimeUsernameProblemLanguageResultExecution timeMemory
473626MamdouhNZigZag (COCI17_zigzag)C++17
80 / 80
290 ms7960 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" map<char,vector<string>>idk; map<char,int>lol; set<char>diff; main() { int n,q; cin>>n>>q; for(int i=0;i<n;i++) { string s; cin>>s; diff.insert(s[0]); idk[s[0]].push_back(s); } for(auto v:diff)sort(idk[v].begin(),idk[v].end()); while(q--) { char c; cin>>c; cout<<idk[c][lol[c]]<<endl; lol[c]++; if(lol[c]==idk[c].size())lol[c]=0; } }

Compilation message (stderr)

zigzag.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main()
      | ^~~~
zigzag.cpp: In function 'int main()':
zigzag.cpp:28:18: warning: comparison of integer expressions of different signedness: 'std::map<char, long long int>::mapped_type' {aka 'long long int'} and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         if(lol[c]==idk[c].size())lol[c]=0;
#Verdict Execution timeMemoryGrader output
Fetching results...