Submission #493471

# Submission time Handle Problem Language Result Execution time Memory
493471 2021-12-11T14:17:21 Z goodluck2020 Palindrome-Free Numbers (BOI13_numbers) C++14
42.5 / 100
70 ms 316 KB
#include <bits/stdc++.h>
#define task "numbers"
#define sz(X) ((int)X.size())
using namespace std;
int L, R;
struct
{
    bool PalinFree(long long k)
    {
        string S;
        stringstream ss;
        ss << k;
        ss >> S;
        for(int i = 1; i < sz(S); i++)
        {
            if(S[i] == S[i-1]) return 0;
            if(i > 1 && S[i] == S[i-2]) return 0;
        }
        return 1;
    }
    void solve()
    {
        int ans = 0;
        for(long long i = L; i <= R; i++)
        if(PalinFree(i)) ans++;
        cout << ans;
    }
} sub1;
int main()
{
    if(fopen(task ".inp","r"))
    {
        freopen(task ".inp","r",stdin);
        freopen(task ".out","w",stdout);
    }
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> L >> R;
    if(R - L <= 1e5) sub1.solve();
}

Compilation message

numbers.cpp: In function 'int main()':
numbers.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen(task ".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
numbers.cpp:34:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |         freopen(task ".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Correct 70 ms 300 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 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 60 ms 204 KB Output is correct
15 Correct 56 ms 288 KB Output is correct
16 Correct 3 ms 204 KB Output is correct
17 Correct 19 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Incorrect 1 ms 204 KB Output isn't correct
20 Correct 64 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Incorrect 0 ms 204 KB Output isn't correct
10 Incorrect 1 ms 204 KB Output isn't correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Incorrect 0 ms 204 KB Output isn't correct
13 Incorrect 1 ms 204 KB Output isn't correct
14 Incorrect 0 ms 204 KB Output isn't correct
15 Incorrect 0 ms 204 KB Output isn't correct
16 Incorrect 0 ms 204 KB Output isn't correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Incorrect 1 ms 204 KB Output isn't correct
22 Correct 1 ms 204 KB Output is correct
23 Incorrect 0 ms 204 KB Output isn't correct
24 Correct 1 ms 204 KB Output is correct
25 Incorrect 0 ms 204 KB Output isn't correct
26 Incorrect 0 ms 204 KB Output isn't correct
27 Incorrect 0 ms 204 KB Output isn't correct
28 Incorrect 0 ms 204 KB Output isn't correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Incorrect 0 ms 204 KB Output isn't correct
32 Correct 0 ms 204 KB Output is correct
33 Incorrect 0 ms 204 KB Output isn't correct
34 Correct 1 ms 284 KB Output is correct
35 Incorrect 0 ms 204 KB Output isn't correct
36 Incorrect 1 ms 204 KB Output isn't correct
37 Incorrect 0 ms 204 KB Output isn't correct
38 Incorrect 0 ms 204 KB Output isn't correct
39 Incorrect 0 ms 204 KB Output isn't correct
40 Correct 1 ms 316 KB Output is correct
41 Incorrect 1 ms 204 KB Output isn't correct
42 Correct 1 ms 204 KB Output is correct
43 Incorrect 0 ms 204 KB Output isn't correct
44 Incorrect 0 ms 316 KB Output isn't correct
45 Incorrect 1 ms 204 KB Output isn't correct