Submission #284981

#TimeUsernameProblemLanguageResultExecution timeMemory
284981shrek12357Rima (COCI17_rima)C++14
28 / 140
1095 ms41276 KiB
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <climits> #include <cmath> #include <fstream> #include <queue> using namespace std; bool comp(string a, string b) { return a.size() < b.size(); } int main() { int n; cin >> n; vector<string> words; map<string, int> count; for (int i = 0; i < n; i++) { string s; cin >> s; words.push_back(s); } sort(words.begin(), words.end(), comp); int best = 0; for (int i = 0; i < words.size(); i++) { count[words[i]] = count[words[i].substr(1)] + 1; count[words[i].substr(1)]++; best = max(best, max(count[words[i]], count[words[i].substr(1)])); } cout << best << endl; }

Compilation message (stderr)

rima.cpp: In function 'int main()':
rima.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for (int i = 0; i < words.size(); i++) {
      |                  ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...