Submission #743666

# Submission time Handle Problem Language Result Execution time Memory
743666 2023-05-17T16:22:45 Z vjudge1 Rima (COCI17_rima) C++17
28 / 140
189 ms 18588 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 2e5 + 5, M = 1e6 + 6, mod = 998244353;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<string> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        reverse(v[i].begin(), v[i].end());
    }
    sort(v.begin(), v.end());
    int cnt = 1, ans = 1;
    for (int i = 1; i < n; ++i) {
        if (abs(int(v[i].size()) - int(v[i - 1].size())) <= 1){
            int mx = max(int(v[i].size()) , int(v[i - 1].size()));
            if(v[i].substr(0,mx-1) == v[i-1].substr(0,mx-1)){
                cnt++;
            }
            else
                cnt = 1;
        }
        else
            cnt = 1;
        ans = max(ans,cnt);
    }
    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Incorrect 189 ms 18588 KB Output isn't correct
5 Correct 14 ms 6220 KB Output is correct
6 Incorrect 4 ms 1768 KB Output isn't correct
7 Incorrect 4 ms 1388 KB Output isn't correct
8 Incorrect 2 ms 1212 KB Output isn't correct
9 Incorrect 18 ms 6824 KB Output isn't correct
10 Incorrect 3 ms 1432 KB Output isn't correct