Submission #860032

# Submission time Handle Problem Language Result Execution time Memory
860032 2023-10-11T11:54:58 Z raphaelp Palindrome-Free Numbers (BOI13_numbers) C++14
7.5 / 100
1 ms 600 KB
#include <bits/stdc++.h>
using namespace std;
long long nb(long long N)
{
    long long mult = 1;
    long long tot = 0;
    int first = 0;
    long long i = 1;
    for (int j = 0; i < N; j++)
    {
        if (N / i > 9 && (N / i) % 10 == (N / i / 10) % 10)
        {
            first = j + 1;
        }
        if (N / i > 99 && (N / i) % 10 == (N / i / 100) % 10)
        {
            first = j + 1;
        }
        i = pow(10, i);
    }
    if (first == 0)
        tot++;
    for (int i = first; N; i++)
    {
        int pos = N % 10;
        if (N > 9 && (N / 10) % 10 < N % 10)
            pos--;
        if (N > 99 && (N / 100) % 10 < N % 10)
            pos--;
        tot += pos * mult;
        N /= 10;
        if (N > 9)
            mult *= 8;
        else
            mult *= 9;
    }
    return tot;
}
int main()
{
    long long a, b;
    cin >> a >> b;
    cout << nb(b) - nb(a - 1) << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 0 ms 600 KB Output isn't correct
3 Runtime error 0 ms 348 KB Execution killed with signal 8
4 Incorrect 0 ms 348 KB Output isn't correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Incorrect 1 ms 348 KB Output isn't correct
14 Incorrect 1 ms 500 KB Output isn't correct
15 Incorrect 0 ms 348 KB Output isn't correct
16 Incorrect 0 ms 348 KB Output isn't correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Runtime error 0 ms 348 KB Execution killed with signal 8
20 Incorrect 0 ms 348 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Runtime error 0 ms 348 KB Execution killed with signal 8
3 Runtime error 0 ms 348 KB Execution killed with signal 8
4 Runtime error 0 ms 348 KB Execution killed with signal 8
5 Incorrect 0 ms 348 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Incorrect 0 ms 348 KB Output isn't correct
11 Incorrect 0 ms 348 KB Output isn't correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Incorrect 0 ms 348 KB Output isn't correct
14 Incorrect 0 ms 348 KB Output isn't correct
15 Incorrect 0 ms 348 KB Output isn't correct
16 Runtime error 1 ms 348 KB Execution killed with signal 8
17 Runtime error 0 ms 348 KB Execution killed with signal 8
18 Runtime error 1 ms 348 KB Execution killed with signal 8
19 Runtime error 0 ms 348 KB Execution killed with signal 8
20 Runtime error 1 ms 348 KB Execution killed with signal 8
21 Runtime error 0 ms 348 KB Execution killed with signal 8
22 Runtime error 0 ms 348 KB Execution killed with signal 8
23 Runtime error 0 ms 348 KB Execution killed with signal 8
24 Runtime error 0 ms 348 KB Execution killed with signal 8
25 Runtime error 0 ms 348 KB Execution killed with signal 8
26 Runtime error 0 ms 348 KB Execution killed with signal 8
27 Runtime error 0 ms 348 KB Execution killed with signal 8
28 Runtime error 1 ms 348 KB Execution killed with signal 8
29 Runtime error 1 ms 348 KB Execution killed with signal 8
30 Runtime error 1 ms 500 KB Execution killed with signal 8
31 Runtime error 1 ms 344 KB Execution killed with signal 8
32 Runtime error 1 ms 348 KB Execution killed with signal 8
33 Runtime error 1 ms 344 KB Execution killed with signal 8
34 Runtime error 0 ms 360 KB Execution killed with signal 8
35 Runtime error 1 ms 348 KB Execution killed with signal 8
36 Runtime error 1 ms 348 KB Execution killed with signal 8
37 Runtime error 1 ms 348 KB Execution killed with signal 8
38 Runtime error 0 ms 348 KB Execution killed with signal 8
39 Runtime error 1 ms 348 KB Execution killed with signal 8
40 Runtime error 1 ms 544 KB Execution killed with signal 8
41 Runtime error 0 ms 348 KB Execution killed with signal 8
42 Runtime error 1 ms 348 KB Execution killed with signal 8
43 Runtime error 0 ms 348 KB Execution killed with signal 8
44 Runtime error 1 ms 348 KB Execution killed with signal 8
45 Runtime error 0 ms 348 KB Execution killed with signal 8