Submission #457962

# Submission time Handle Problem Language Result Execution time Memory
457962 2021-08-07T15:57:29 Z myvaluska Palindrome-Free Numbers (BOI13_numbers) C++14
36.6667 / 100
1000 ms 304 KB

// palindromefree.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <string>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int a;
    long long int b;
    cin >> a;
    cin >> b;
    long long int palfree = 0;
    for (long long int i = a; i <= b; i++)
    {
        string s;
        s = to_string(i);
        int palindrom = 0;
        for (int j = 0; j < s.size()-1; j++)
        {
            if (s[j] == s[j + 1] || (j < s.size() - 2 && s[j] == s[j + 2]))
            {
                palindrom += 1;
                break;
            }
        }
        if (palindrom == 0)
        {
            palfree += 1;
        }
        else
        {
        
        }
    }
    cout << palfree << "\n";
    //std::cout << "Hello World!\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file

Compilation message

numbers.cpp: In function 'int main()':
numbers.cpp:23:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for (int j = 0; j < s.size()-1; j++)
      |                         ~~^~~~~~~~~~~~
numbers.cpp:25:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             if (s[j] == s[j + 1] || (j < s.size() - 2 && s[j] == s[j + 2]))
      |                                      ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 11 ms 304 KB Output is correct
4 Correct 4 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 4 ms 204 KB Output is correct
15 Correct 5 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 2 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 10 ms 204 KB Output is correct
20 Correct 4 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 325 ms 204 KB Output is correct
2 Execution timed out 1086 ms 204 KB Time limit exceeded
3 Execution timed out 1083 ms 204 KB Time limit exceeded
4 Execution timed out 1080 ms 204 KB Time limit exceeded
5 Execution timed out 1071 ms 204 KB Time limit exceeded
6 Execution timed out 1082 ms 204 KB Time limit exceeded
7 Correct 121 ms 284 KB Output is correct
8 Correct 91 ms 300 KB Output is correct
9 Correct 158 ms 204 KB Output is correct
10 Correct 214 ms 204 KB Output is correct
11 Correct 336 ms 204 KB Output is correct
12 Execution timed out 1084 ms 204 KB Time limit exceeded
13 Correct 338 ms 284 KB Output is correct
14 Execution timed out 1089 ms 204 KB Time limit exceeded
15 Execution timed out 1078 ms 204 KB Time limit exceeded
16 Execution timed out 1088 ms 204 KB Time limit exceeded
17 Execution timed out 1078 ms 204 KB Time limit exceeded
18 Execution timed out 1077 ms 204 KB Time limit exceeded
19 Execution timed out 1079 ms 204 KB Time limit exceeded
20 Execution timed out 1063 ms 204 KB Time limit exceeded
21 Execution timed out 1043 ms 204 KB Time limit exceeded
22 Execution timed out 1085 ms 204 KB Time limit exceeded
23 Execution timed out 1082 ms 204 KB Time limit exceeded
24 Execution timed out 1083 ms 204 KB Time limit exceeded
25 Execution timed out 1086 ms 204 KB Time limit exceeded
26 Execution timed out 1087 ms 204 KB Time limit exceeded
27 Execution timed out 1073 ms 204 KB Time limit exceeded
28 Execution timed out 1075 ms 204 KB Time limit exceeded
29 Execution timed out 1063 ms 204 KB Time limit exceeded
30 Execution timed out 1097 ms 204 KB Time limit exceeded
31 Execution timed out 1074 ms 204 KB Time limit exceeded
32 Execution timed out 1092 ms 204 KB Time limit exceeded
33 Execution timed out 1081 ms 204 KB Time limit exceeded
34 Execution timed out 1088 ms 204 KB Time limit exceeded
35 Execution timed out 1089 ms 204 KB Time limit exceeded
36 Execution timed out 1078 ms 204 KB Time limit exceeded
37 Execution timed out 1087 ms 204 KB Time limit exceeded
38 Execution timed out 1093 ms 204 KB Time limit exceeded
39 Execution timed out 1095 ms 204 KB Time limit exceeded
40 Execution timed out 1094 ms 204 KB Time limit exceeded
41 Execution timed out 1088 ms 204 KB Time limit exceeded
42 Execution timed out 1096 ms 204 KB Time limit exceeded
43 Execution timed out 1069 ms 204 KB Time limit exceeded
44 Execution timed out 1093 ms 204 KB Time limit exceeded
45 Execution timed out 1083 ms 204 KB Time limit exceeded