답안 #472774

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472774 2021-09-14T10:05:20 Z SaraMostafa Lozinke (COCI17_lozinke) C++14
100 / 100
273 ms 16400 KB
#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define endl "\n"
#define Sara ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const long long mod=998244353;
const double PI=acos(-1);
int main()
{
    //freopen("input.in","r",stdin);
    Sara
    int n;
    cin>>n;
    vector<string>v(n);
    map<string,ll>mp;
    for(int i=0; i<n; i++)
    {
        cin>>v[i];
        mp[v[i]]++;
    }
    ll cnt=0;

    for(int i=0; i<n; i++)
    {
            map<string,bool>vs;

        for(int k=0; k<v[i].size(); k++)
        {
            string c="";
            for(int j=k; j<v[i].size(); j++)
            {
                c+=v[i][j];
                if(mp[c]==0 || vs[c]) continue;
                else if(c==v[i])
               cnt+=(mp[c]-1);
               else cnt+=mp[c];
               vs[c]=1;
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:28:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for(int k=0; k<v[i].size(); k++)
      |                      ~^~~~~~~~~~~~
lozinke.cpp:31:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for(int j=k; j<v[i].size(); j++)
      |                          ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 380 KB Output is correct
5 Correct 10 ms 640 KB Output is correct
6 Correct 12 ms 712 KB Output is correct
7 Correct 20 ms 1356 KB Output is correct
8 Correct 20 ms 2236 KB Output is correct
9 Correct 129 ms 2304 KB Output is correct
10 Correct 111 ms 7440 KB Output is correct
11 Correct 172 ms 4228 KB Output is correct
12 Correct 261 ms 16400 KB Output is correct
13 Correct 191 ms 2780 KB Output is correct
14 Correct 271 ms 14788 KB Output is correct
15 Correct 273 ms 16208 KB Output is correct
16 Correct 138 ms 1072 KB Output is correct
17 Correct 38 ms 844 KB Output is correct
18 Correct 37 ms 844 KB Output is correct
19 Correct 207 ms 8460 KB Output is correct
20 Correct 161 ms 972 KB Output is correct