답안 #152098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152098 2019-09-06T11:54:43 Z Runtime_error_ Lozinke (COCI17_lozinke) C++14
100 / 100
533 ms 16644 KB

#include <bits/stdc++.h>
using namespace std;
const int inf = 2e4+9;
map<string,int> mp;
vector<string> v;
int main(){

    int n,ans = 0;
    cin>>n;
    for(int i=1;i<=n;i++){
        string tmp;
        set<string> s;
        cin>>tmp;
        for(int j=0;j<tmp.size();j++){
            string cur = "";
            for(int z=j;z<tmp.size();z++)
                cur += tmp[z],s.insert(cur);
        }
        v.push_back(tmp);
        for(auto o:s)
            mp[o] ++;
    }
    for(auto o:v)
        ans += mp[o]-1;
    cout<<ans<<endl;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:16:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<tmp.size();j++){
                     ~^~~~~~~~~~~
lozinke.cpp:18:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int z=j;z<tmp.size();z++)
                         ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 12 ms 760 KB Output is correct
6 Correct 19 ms 760 KB Output is correct
7 Correct 26 ms 1400 KB Output is correct
8 Correct 41 ms 2296 KB Output is correct
9 Correct 103 ms 2544 KB Output is correct
10 Correct 223 ms 7536 KB Output is correct
11 Correct 173 ms 4400 KB Output is correct
12 Correct 500 ms 16580 KB Output is correct
13 Correct 306 ms 3256 KB Output is correct
14 Correct 358 ms 15060 KB Output is correct
15 Correct 533 ms 16644 KB Output is correct
16 Correct 291 ms 1848 KB Output is correct
17 Correct 77 ms 1648 KB Output is correct
18 Correct 62 ms 1612 KB Output is correct
19 Correct 359 ms 8756 KB Output is correct
20 Correct 146 ms 1748 KB Output is correct