# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
843681 | nihaddhuseynli | Lozinke (COCI17_lozinke) | C++14 | 1084 ms | 15800 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |