Submission #472903

#TimeUsernameProblemLanguageResultExecution timeMemory
472903MamdouhNLozinke (COCI17_lozinke)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" int n,ans; string password[200002]; void check(string a,string b) { int sizeofb = b.size(); for(int i = 0;i<a.size();i++) { if(i+b.size()>a.size())break; if(a[i]==b[0]) { int x=i; int j=0; int sz=0; while(a[x]==b[j]&&x<a.size()&&j<sizeofb) { sz++; j++; x++; } if(sz==sizeofb) { ans++; return; } } } } main() { ios_base::sync_with_stdio(false); cin.tie(false); cout.tie(false); cin>>n; for(int i=0;i<n;i++)cin>>password[i]; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(j==i)continue; if(password[j].size()>password[i].size())continue; //cout<<password[i]<<" "<<password[j]<<endl; check(password[i],password[j]); } } cout<<ans<<endl; }

Compilation message (stderr)

lozinke.cpp: In function 'void check(std::string, std::string)':
lozinke.cpp:12:20: 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]
   12 |     for(int i = 0;i<a.size();i++)
      |                   ~^~~~~~~~~
lozinke.cpp:20:32: 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]
   20 |             while(a[x]==b[j]&&x<a.size()&&j<sizeofb)
      |                               ~^~~~~~~~~
lozinke.cpp: At global scope:
lozinke.cpp:35:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   35 | main()
      | ^~~~
lozinke.cpp: In function 'int main()':
lozinke.cpp:38:18: error: no matching function for call to 'std::basic_istream<char>::tie(bool)'
   38 |     cin.tie(false);
      |                  ^
In file included from /usr/include/c++/10/ios:44,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from lozinke.cpp:1:
/usr/include/c++/10/bits/basic_ios.h:295:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
  295 |       tie() const
      |       ^~~
/usr/include/c++/10/bits/basic_ios.h:295:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/10/bits/basic_ios.h:307:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/10/bits/basic_ios.h:307:43: note:   no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*'
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
lozinke.cpp:39:19: error: no matching function for call to 'std::basic_ostream<char>::tie(bool)'
   39 |     cout.tie(false);
      |                   ^
In file included from /usr/include/c++/10/ios:44,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from lozinke.cpp:1:
/usr/include/c++/10/bits/basic_ios.h:295:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
  295 |       tie() const
      |       ^~~
/usr/include/c++/10/bits/basic_ios.h:295:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/10/bits/basic_ios.h:307:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/10/bits/basic_ios.h:307:43: note:   no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*'
  307 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~