답안 #151411

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151411 2019-09-02T18:32:56 Z mayhoubsaleh Lozinke (COCI17_lozinke) C++14
100 / 100
529 ms 16752 KB
#include<bits/stdc++.h>
#define pb push_back

using namespace std;
int n;
string s,a[20222];
int ans;
string sub;
map<string,int>m;
set<string>subs;

void solve(){
    subs.clear();
    for(int l=0;l<s.size();l++){
        sub="";
        for(int r=l;r<s.size();r++){
            sub.pb(s[r]);
            subs.insert(sub);
        }
    }

    for(auto x:subs){
        ans+=m[x];
    }
    ans--;
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        m[a[i]]++;
    }
    for(int i=0;i<n;i++){
        s=a[i];
        solve();
    }
    cout<<ans<<endl;
    return 0;
}

Compilation message

lozinke.cpp: In function 'void solve()':
lozinke.cpp:14:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int l=0;l<s.size();l++){
                 ~^~~~~~~~~
lozinke.cpp:16:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int r=l;r<s.size();r++){
                     ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 888 KB Output is correct
2 Correct 3 ms 1064 KB Output is correct
3 Correct 3 ms 1016 KB Output is correct
4 Correct 4 ms 1016 KB Output is correct
5 Correct 13 ms 1272 KB Output is correct
6 Correct 21 ms 1400 KB Output is correct
7 Correct 28 ms 2040 KB Output is correct
8 Correct 44 ms 2864 KB Output is correct
9 Correct 108 ms 2808 KB Output is correct
10 Correct 231 ms 7848 KB Output is correct
11 Correct 181 ms 4540 KB Output is correct
12 Correct 498 ms 16752 KB Output is correct
13 Correct 328 ms 3056 KB Output is correct
14 Correct 354 ms 15060 KB Output is correct
15 Correct 529 ms 16660 KB Output is correct
16 Correct 309 ms 1364 KB Output is correct
17 Correct 74 ms 1144 KB Output is correct
18 Correct 57 ms 1144 KB Output is correct
19 Correct 355 ms 8824 KB Output is correct
20 Correct 154 ms 1400 KB Output is correct