Submission #469507

# Submission time Handle Problem Language Result Execution time Memory
469507 2021-09-01T08:23:47 Z Karabasan Lozinke (COCI17_lozinke) C++17
0 / 100
1000 ms 1100 KB
#include <bits/stdc++.h>

using namespace std;
int n;
string s[20002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    int cevap=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(j==i)
                continue;
            int k=0;
            for(int z=0;z<s[i].length();z++)
            {
                if(k==s[j].length()-1&&s[i][z]==s[j][k])
                    {
                        cevap++;
                        break;
                    }
                else if(s[i][z]!=s[j][k])
                    k=0;
                else k++;
            }
        }
    }
    printf("%d",cevap);
    return 0;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:24:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |             for(int z=0;z<s[i].length();z++)
      |                         ~^~~~~~~~~~~~~~
lozinke.cpp:26:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |                 if(k==s[j].length()-1&&s[i][z]==s[j][k])
      |                    ~^~~~~~~~~~~~~~~~~
lozinke.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 844 KB Output isn't correct
2 Incorrect 1 ms 844 KB Output isn't correct
3 Incorrect 1 ms 944 KB Output isn't correct
4 Incorrect 1 ms 844 KB Output isn't correct
5 Incorrect 6 ms 948 KB Output isn't correct
6 Incorrect 19 ms 952 KB Output isn't correct
7 Incorrect 32 ms 960 KB Output isn't correct
8 Incorrect 43 ms 844 KB Output isn't correct
9 Execution timed out 1091 ms 972 KB Time limit exceeded
10 Execution timed out 1068 ms 972 KB Time limit exceeded
11 Execution timed out 1081 ms 972 KB Time limit exceeded
12 Execution timed out 1098 ms 972 KB Time limit exceeded
13 Execution timed out 1087 ms 1100 KB Time limit exceeded
14 Execution timed out 1084 ms 972 KB Time limit exceeded
15 Execution timed out 1090 ms 1100 KB Time limit exceeded
16 Execution timed out 1081 ms 1100 KB Time limit exceeded
17 Execution timed out 1094 ms 1100 KB Time limit exceeded
18 Execution timed out 1099 ms 1100 KB Time limit exceeded
19 Execution timed out 1082 ms 972 KB Time limit exceeded
20 Execution timed out 1077 ms 972 KB Time limit exceeded