# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
284981 | shrek12357 | Rima (COCI17_rima) | C++14 | 1095 ms | 41276 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |