답안 #170363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170363 2019-12-24T22:01:56 Z mdn2002 Lozinke (COCI17_lozinke) C++14
100 / 100
575 ms 16548 KB
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
int n,ans;
map<string,int>mp;
map<string,int>m;
vector<string>v;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("lemonade.in","r",stdin);
    //freopen("lemonade.out","w",stdout);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        v.push_back(s);
        mp[s]++;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
        {
            string s;
            for(int z=j;z<v[i].size();z++)
            {
                s.push_back(v[i][z]);
                if(m[s]==0)
                {
                    ans+=mp[s];
                    m[s]++;
                }
            }
        }
        m.clear();
    }
    cout<<ans-n;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:25:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<v[i].size();j++)
                     ~^~~~~~~~~~~~
lozinke.cpp:28:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int z=j;z<v[i].size();z++)
                         ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 372 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 14 ms 760 KB Output is correct
6 Correct 22 ms 760 KB Output is correct
7 Correct 29 ms 1528 KB Output is correct
8 Correct 47 ms 2300 KB Output is correct
9 Correct 118 ms 2440 KB Output is correct
10 Correct 251 ms 7536 KB Output is correct
11 Correct 196 ms 4336 KB Output is correct
12 Correct 555 ms 16548 KB Output is correct
13 Correct 372 ms 2832 KB Output is correct
14 Correct 386 ms 15088 KB Output is correct
15 Correct 575 ms 16488 KB Output is correct
16 Correct 373 ms 1608 KB Output is correct
17 Correct 59 ms 1524 KB Output is correct
18 Correct 45 ms 1524 KB Output is correct
19 Correct 388 ms 8696 KB Output is correct
20 Correct 174 ms 1600 KB Output is correct