답안 #929172

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
929172 2024-02-17T19:44:14 Z Zena_Hossam Lozinke (COCI17_lozinke) C++14
100 / 100
315 ms 16640 KB
#include <bits/stdc++.h>
using namespace std;
#define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define ll double
#define ll long long
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
int main()
{
    // freopen("maxcross.in","r",stdin);freopen("maxcross.out","w",stdout);

    ll T=1;
    //cin>>T;ll oo=0;
    while(T--)
    {
        ll n;
        cin>>n;
        string a[n];
        map<string,ll>m,d;
        for(ll i=0; i<n; i++)
        {
            cin>>a[i];
            string e="";
            for(ll j=0; j<a[i].sz; j++)
            {
                e+=a[i][j];
                d[e]=1;
            }
            m[a[i]]++;
        }
        ll c=0;
        for(ll i=0; i<n; i++)
        {map<string,ll>oo;
            for(ll j=0; j<a[i].sz; j++)
            {
                string e="";
                for(ll o=j;o<a[i].sz;o++){
                    e+=a[i][o];if(m[e]&&!oo[e]){oo[e]=1;
                    c+=m[e]-(e==a[i]);//cout<<i<<" "<<j<<" "<<e<<"\n";
                    }
                    if(!d[e])break;
                }
            }
        }
        cout<<c;
    }
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:27:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             for(ll j=0; j<a[i].sz; j++)
      |                          ^
lozinke.cpp:37:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             for(ll j=0; j<a[i].sz; j++)
      |                          ^
lozinke.cpp:40:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |                 for(ll o=j;o<a[i].sz;o++){
      |                             ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 9 ms 860 KB Output is correct
6 Correct 14 ms 860 KB Output is correct
7 Correct 19 ms 1676 KB Output is correct
8 Correct 20 ms 2384 KB Output is correct
9 Correct 117 ms 3508 KB Output is correct
10 Correct 132 ms 8104 KB Output is correct
11 Correct 182 ms 5752 KB Output is correct
12 Correct 259 ms 15076 KB Output is correct
13 Correct 251 ms 4336 KB Output is correct
14 Correct 268 ms 15952 KB Output is correct
15 Correct 315 ms 16640 KB Output is correct
16 Correct 195 ms 1320 KB Output is correct
17 Correct 60 ms 860 KB Output is correct
18 Correct 50 ms 860 KB Output is correct
19 Correct 252 ms 10308 KB Output is correct
20 Correct 165 ms 1116 KB Output is correct