Submission #929135

#TimeUsernameProblemLanguageResultExecution timeMemory
929135Zena_HossamLozinke (COCI17_lozinke)C++14
0 / 100
1072 ms1372 KiB
#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;
        pair<ll,string>a[n];
        for(ll i=0;i<n;i++){
            cin>>a[i].second;
            a[i].first=a[i].second.size();
        }
        sort(a,a+n);ll c=0;
        for(ll i=0;i<n;i++){

            for(ll j=i+1;j<n;j++){string x="";
                for(ll e=0;e<a[j].first;e++){

                    if(x.size()>=a[i].first){
                        reverse(all(x));
                        x.pop_back();
                        reverse(all(x));

                    }x+=a[j].second[e];//cout<<x<<" ";
                    if(x==a[i].second){
                        c++;//cout<<i<<" "<<j<<" "<<x<<" "<<a[i].second<<" "<<a[j].second;
                        break;
                    }

                }//cout<<"\n";
            }
        }cout<<c;
    }
}

Compilation message (stderr)

lozinke.cpp: In function 'int main()':
lozinke.cpp:32:32: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   32 |                     if(x.size()>=a[i].first){
      |                        ~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...