답안 #472757

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472757 2021-09-14T09:35:23 Z MamdouhN Lozinke (COCI17_lozinke) C++14
15 / 100
1000 ms 6536 KB
#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)
{
    bool cando=0;
    int sizeofb = b.size();
    int i=0;
    while(i+b.size()<=a.size())
    {
        if(a[i]==b[0])
        {
            int j=0,sizee=0;
            while(a[i]==b[j]&&i<a.size()&&j<sizeofb)
            {
                i++;
                j++;
                sizee++;
            }
            i--;
            //cout<<sizee<<endl;
            if(sizee==sizeofb)
            {
                ans++;
                return;
            }
        }
        i++;
    }
}

main()
{
    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

lozinke.cpp: In function 'void check(std::string, std::string)':
lozinke.cpp:19: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]
   19 |             while(a[i]==b[j]&&i<a.size()&&j<sizeofb)
      |                               ~^~~~~~~~~
lozinke.cpp:11:10: warning: unused variable 'cando' [-Wunused-variable]
   11 |     bool cando=0;
      |          ^~~~~
lozinke.cpp: At global scope:
lozinke.cpp:37:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 6476 KB Output isn't correct
2 Correct 4 ms 6532 KB Output is correct
3 Incorrect 4 ms 6476 KB Output isn't correct
4 Correct 11 ms 6476 KB Output is correct
5 Incorrect 33 ms 6476 KB Output isn't correct
6 Incorrect 71 ms 6532 KB Output isn't correct
7 Incorrect 111 ms 6536 KB Output isn't correct
8 Correct 97 ms 6476 KB Output is correct
9 Execution timed out 1086 ms 6476 KB Time limit exceeded
10 Execution timed out 1077 ms 6476 KB Time limit exceeded
11 Execution timed out 1049 ms 6476 KB Time limit exceeded
12 Execution timed out 1095 ms 6476 KB Time limit exceeded
13 Execution timed out 1073 ms 6476 KB Time limit exceeded
14 Execution timed out 1095 ms 6476 KB Time limit exceeded
15 Execution timed out 1095 ms 6476 KB Time limit exceeded
16 Execution timed out 1094 ms 6476 KB Time limit exceeded
17 Execution timed out 1070 ms 6476 KB Time limit exceeded
18 Execution timed out 1098 ms 6476 KB Time limit exceeded
19 Execution timed out 1097 ms 6476 KB Time limit exceeded
20 Execution timed out 1088 ms 6476 KB Time limit exceeded