Submission #473003

#TimeUsernameProblemLanguageResultExecution timeMemory
473003MamdouhNLozinke (COCI17_lozinke)C++14
25 / 100
1101 ms65540 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" int n,ans; string password[20005]; //map<string,bool>idk; map<string,map<string,bool>>idk; void get_subs(string s) { string x; for(int i=0;i<s.size();i++) { x+=s[i]; idk[s][x]=1; string y; int j = i; while(j>=0&&y.size()<s.size()) { y=s[j]+y; idk[s][y]=1; j--; } } } void check(string a,string b) { if(idk[a][b])ans++; } main() { cin>>n; for(int i=0;i<n;i++)cin>>password[i]; for(int i=0;i<n;i++) { get_subs(password[i]); } for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { if(j==i)continue; check(password[i],password[j]); check(password[j],password[i]); } } cout<<ans<<endl; }

Compilation message (stderr)

lozinke.cpp: In function 'void get_subs(std::string)':
lozinke.cpp:14:18: 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]
   14 |     for(int i=0;i<s.size();i++)
      |                 ~^~~~~~~~~
lozinke.cpp: At global scope:
lozinke.cpp:34:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   34 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...