답안 #929075

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
929075 2024-02-17T16:22:34 Z sondos225 Lozinke (COCI17_lozinke) C++17
50 / 100
1000 ms 4892 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define yes "YES"
#define no "NO"
#define bigg INT_MAX
#define debug(x) cout<<(#x)<<" = " <<x<<endl;
#define all(x) x.begin(),x.end()
#define sz size()
#define nn '\n'
#define mms(x,y) memset(x,y,sizeof(x))
#define forr(i,j,n) for (int i=j; i<n; i++)
#define forn(i,j,n) for (int i=j; i>n; i--)
#define fi first
#define se second
#define la "LA"
#define cinn(x,y) for(int i=0; i<y; i++) cin>>x[i];
#define pii pair<int,int>
signed main()
{
//    #ifndef LOCAL
//    freopen("helpcross.in","r",stdin);
//    freopen("helpcross.out","w", stdout);
//    #endif
    fast
    int n;
    cin>>n;
    string a[n];
    map<string,int> m;
    map<string,bool> b;
    forr(i,0,n)
    {
        cin>>a[i];
        m[a[i]]++;
        b[a[i]]=1;
    }
    int ans=0;
    forr(k,0,n)
    {
        string s=a[k];
        int w=s.sz;
        map<string,bool> cb=b;
        forr(j,0,w)
        {
            string cur="";
            forr(i,j,w)
            {
                cur+=s[i];
                //cout<<k<<' '<<cur<<endl;
                if (cb[cur]) ans+=m[cur];
                cb[cur]=0;
            }
           // cout<<k<<' '<<cur<<endl;
        }
    }
    cout<<ans-n;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 7 ms 348 KB Output is correct
5 Correct 29 ms 664 KB Output is correct
6 Correct 72 ms 768 KB Output is correct
7 Correct 143 ms 860 KB Output is correct
8 Correct 110 ms 812 KB Output is correct
9 Execution timed out 1079 ms 1884 KB Time limit exceeded
10 Execution timed out 1073 ms 2136 KB Time limit exceeded
11 Execution timed out 1064 ms 2908 KB Time limit exceeded
12 Execution timed out 1062 ms 3164 KB Time limit exceeded
13 Execution timed out 1087 ms 3932 KB Time limit exceeded
14 Execution timed out 1071 ms 4892 KB Time limit exceeded
15 Execution timed out 1049 ms 4180 KB Time limit exceeded
16 Execution timed out 1018 ms 1624 KB Time limit exceeded
17 Correct 62 ms 1060 KB Output is correct
18 Correct 46 ms 1056 KB Output is correct
19 Execution timed out 1012 ms 3928 KB Time limit exceeded
20 Execution timed out 1071 ms 1372 KB Time limit exceeded