답안 #284981

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
284981 2020-08-28T08:40:37 Z shrek12357 Rima (COCI17_rima) C++14
28 / 140
1000 ms 41276 KB
#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

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++) {
      |                  ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 384 KB Output isn't correct
4 Execution timed out 1095 ms 41276 KB Time limit exceeded
5 Correct 168 ms 9080 KB Output is correct
6 Incorrect 40 ms 3052 KB Output isn't correct
7 Incorrect 37 ms 2664 KB Output isn't correct
8 Incorrect 26 ms 2284 KB Output isn't correct
9 Incorrect 220 ms 12004 KB Output isn't correct
10 Incorrect 28 ms 2412 KB Output isn't correct