Submission #843681

# Submission time Handle Problem Language Result Execution time Memory
843681 2023-09-04T12:08:03 Z nihaddhuseynli Lozinke (COCI17_lozinke) C++14
40 / 100
1000 ms 15800 KB
//Bismillahi Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
const int N = 1000100;
const ll inf =1000001;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
ll n,m,l,r,x,y,k,cnt,cnt1,flag,flag1,maxx,minn,sum,sum1,a[inf],b[inf],ans,ans1;
ll visited[500001];
ll d[1000][1000],ok[1000][1000];
ll c[100001];
string str,str1,str2,str3;
const int md =1e9+7;
vector<pair<ll,ll>>v,p;
vector<ll> v2;
map<ll,ll>mp;
set<ll>s;
multiset<ll> ms;
stack<ll>st;
double pi=3.14159265358979323846;
vector<ll> v1[500001];
ll dp[2023][2023],dis[200001];
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define RESET(a, b) memset(a, b, sizeof(a))
#define ins insert
#define fi first
#define se second
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define TC(t) while (t--)
/**********/
void solve()
{
      
    cin >> n;
    string a[n+5];
    FOR(i,0,n)
    {
      cin >> a[i];
    }
    FOR(i,0,n)
    {
      FOR(j,i+1,n)
      {
        if(a[i].find(a[j])!=string::npos)
        {
            cnt++;
        }
        if(a[j].find(a[i])!=string::npos)
        {
            cnt++;
        }
      }
    }
    cout << cnt << endl;


}
/**********/
int main()
{       
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    int i =1;
    //cin >> t;
    //freopen("homework.in", "r", stdin);
    //freopen("homework.out", "w", stdout);   
    TC(t)
    {   
        solve();
    }
    return 0;
}

Compilation message

lozinke.cpp: In function 'void solve()':
lozinke.cpp:24:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   24 | #define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
      |                              ^
lozinke.cpp:45:5: note: in expansion of macro 'FOR'
   45 |     FOR(i,0,n)
      |     ^~~
lozinke.cpp:24:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   24 | #define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
      |                              ^
lozinke.cpp:49:5: note: in expansion of macro 'FOR'
   49 |     FOR(i,0,n)
      |     ^~~
lozinke.cpp:24:30: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   24 | #define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
      |                              ^
lozinke.cpp:51:7: note: in expansion of macro 'FOR'
   51 |       FOR(j,i+1,n)
      |       ^~~
lozinke.cpp: In function 'int main()':
lozinke.cpp:73:9: warning: unused variable 'i' [-Wunused-variable]
   73 |     int i =1;
      |         ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 14836 KB Output is correct
2 Correct 3 ms 14932 KB Output is correct
3 Correct 3 ms 14684 KB Output is correct
4 Correct 6 ms 14848 KB Output is correct
5 Correct 17 ms 14684 KB Output is correct
6 Correct 36 ms 14876 KB Output is correct
7 Correct 53 ms 14684 KB Output is correct
8 Correct 42 ms 14908 KB Output is correct
9 Execution timed out 1018 ms 15068 KB Time limit exceeded
10 Execution timed out 1014 ms 15196 KB Time limit exceeded
11 Execution timed out 1045 ms 15196 KB Time limit exceeded
12 Execution timed out 1026 ms 15196 KB Time limit exceeded
13 Execution timed out 1052 ms 15452 KB Time limit exceeded
14 Execution timed out 1066 ms 15452 KB Time limit exceeded
15 Execution timed out 1014 ms 15800 KB Time limit exceeded
16 Execution timed out 1018 ms 15452 KB Time limit exceeded
17 Execution timed out 1040 ms 15704 KB Time limit exceeded
18 Execution timed out 1049 ms 15452 KB Time limit exceeded
19 Execution timed out 1062 ms 15452 KB Time limit exceeded
20 Execution timed out 1084 ms 15336 KB Time limit exceeded