Submission #929167

#TimeUsernameProblemLanguageResultExecution timeMemory
929167Zena_HossamLozinke (COCI17_lozinke)C++14
Compilation error
0 ms0 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; 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++) { for(ll j=0; j<a[i].sz; j++) { string e=""; while(!e.sz||d[e]) { if(k+j<a[i].sz) { e+=a[i][j+k]; c+=(m[e]-(e==a[i])); } k++; else break; } } } cout<<c; } }

Compilation message (stderr)

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:42:24: error: 'k' was not declared in this scope
   42 |                     if(k+j<a[i].sz)
      |                        ^
lozinke.cpp:47:21: error: 'k' was not declared in this scope
   47 |                     k++;
      |                     ^
lozinke.cpp:48:21: error: 'else' without a previous 'if'
   48 |                     else break;
      |                     ^~~~