답안 #472772

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472772 2021-09-14T09:57:41 Z SaraMostafa Lozinke (COCI17_lozinke) C++14
40 / 100
1000 ms 2124 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;
    sort(v.begin(),v.end());
    for(int i=0; i<n; i++)
    {
        vector<bool>vs(n);
        vs[i]=1;
        for(int k=0; k<v[i].size(); k++)
        {
            string c="";
            for(int j=k; j<v[i].size(); j++)
            {
                c+=v[i][j];
                for(int h=0; h<n; h++)
                {
                    if(vs[h])
                        continue;
                    if(v[h]==c)
                    {
                        cnt++;
                        vs[h]=1;
                    }
                }
            }
        }
        vs.clear();
    }
    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 204 KB Output is correct
4 Correct 6 ms 348 KB Output is correct
5 Correct 61 ms 392 KB Output is correct
6 Correct 142 ms 436 KB Output is correct
7 Correct 241 ms 472 KB Output is correct
8 Correct 249 ms 464 KB Output is correct
9 Execution timed out 1083 ms 1100 KB Time limit exceeded
10 Execution timed out 1053 ms 1100 KB Time limit exceeded
11 Execution timed out 1087 ms 1484 KB Time limit exceeded
12 Execution timed out 1068 ms 1548 KB Time limit exceeded
13 Execution timed out 1095 ms 1868 KB Time limit exceeded
14 Execution timed out 1087 ms 2124 KB Time limit exceeded
15 Execution timed out 1093 ms 1996 KB Time limit exceeded
16 Execution timed out 1087 ms 1072 KB Time limit exceeded
17 Execution timed out 1092 ms 948 KB Time limit exceeded
18 Execution timed out 1086 ms 844 KB Time limit exceeded
19 Execution timed out 1080 ms 1868 KB Time limit exceeded
20 Execution timed out 1098 ms 972 KB Time limit exceeded