답안 #933111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
933111 2024-02-25T05:29:09 Z dubious_dude Lozinke (COCI17_lozinke) C++17
0 / 100
1000 ms 2328 KB
#include <bits/stdc++.h>
using namespace std;
#define fast_io cin.tie(0)->sync_with_stdio(false);

bool isTrue(string &s1, string &s2) {
    return (s1.find(s2) != s1.npos || s2.find(s1) != s2.npos);
}


int main() {
    fast_io;

    int n; cin >> n;
    vector<string> pass(n);
    unordered_set<string> extras;

    for(int i=0; i<n; i++) {
        cin >> pass[i];
        extras.insert(pass[i]);
    }
    sort(pass.begin(),pass.end());

    int res = (n == extras.size()) ? 0 : abs(long (n-extras.size()));
    for(int i=0; i<n-1; i++) {
        if(!isTrue(pass[i],pass[i+1])) continue;

        res++;
        int j=i+2;

        while(j<n) {
            if(!isTrue(pass[i],pass[j])) break;
            res++;
            j++;
        }
    }

    cout << res;


    return 0;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:23:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::unordered_set<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     int res = (n == extras.size()) ? 0 : abs(long (n-extras.size()));
      |                ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Incorrect 1 ms 348 KB Output isn't correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Incorrect 2 ms 604 KB Output isn't correct
8 Incorrect 1 ms 604 KB Output isn't correct
9 Incorrect 34 ms 1116 KB Output isn't correct
10 Incorrect 4 ms 1112 KB Output isn't correct
11 Incorrect 55 ms 1372 KB Output isn't correct
12 Incorrect 6 ms 1624 KB Output isn't correct
13 Incorrect 11 ms 2328 KB Output isn't correct
14 Incorrect 24 ms 2140 KB Output isn't correct
15 Incorrect 9 ms 1884 KB Output isn't correct
16 Incorrect 10 ms 1116 KB Output isn't correct
17 Execution timed out 1091 ms 856 KB Time limit exceeded
18 Execution timed out 1048 ms 860 KB Time limit exceeded
19 Incorrect 9 ms 1880 KB Output isn't correct
20 Incorrect 113 ms 1116 KB Output isn't correct