Submission #1120253

# Submission time Handle Problem Language Result Execution time Memory
1120253 2024-11-28T06:46:06 Z vjudge1 Palindrome-Free Numbers (BOI13_numbers) C++17
15 / 100
1000 ms 564 KB
#include<bits/stdc++.h>

#define ll long long
#define pb push_back
#define in insert
#define fi first
#define se second
#define vl vector<ll>
#define all(v) v.begin(), v.end()
#define endl "\n"

using namespace std;
const int sz = 1e6 + 5; /// mind this
const int MAX = 2e6 + 123;
const int BS = 61;
const int mod = 998244353;

void solve(){
    ll a, b, i, j, ans = 0;
    cin >> a >> b;
    for(i = a; i <= b; i++){
        ll x = i;
        bool ok = 1;
        while(x > 10){
            ll m = (x % 1000);
            if(m > 100)ok &= ((ll)(m % 10) != (ll)(m / 100));
            m = (x % 100);
            ok &= ((ll)(m % 10) != (ll)(m / 10));
            if(!ok){break;}
            x /= 10;
        }
        ans += ok;
    }
    cout << ans << endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

/*
123 321
*/

Compilation message

numbers.cpp: In function 'void solve()':
numbers.cpp:19:17: warning: unused variable 'j' [-Wunused-variable]
   19 |     ll a, b, i, j, ans = 0;
      |                 ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Incorrect 4 ms 460 KB Output isn't correct
4 Incorrect 3 ms 336 KB Output isn't correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Incorrect 3 ms 564 KB Output isn't correct
15 Incorrect 3 ms 336 KB Output isn't correct
16 Incorrect 1 ms 336 KB Output isn't correct
17 Incorrect 1 ms 336 KB Output isn't correct
18 Correct 2 ms 336 KB Output is correct
19 Incorrect 4 ms 336 KB Output isn't correct
20 Incorrect 3 ms 348 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 147 ms 440 KB Output isn't correct
2 Execution timed out 1072 ms 336 KB Time limit exceeded
3 Execution timed out 1053 ms 336 KB Time limit exceeded
4 Execution timed out 1064 ms 336 KB Time limit exceeded
5 Execution timed out 1029 ms 336 KB Time limit exceeded
6 Execution timed out 1041 ms 336 KB Time limit exceeded
7 Incorrect 59 ms 336 KB Output isn't correct
8 Incorrect 47 ms 336 KB Output isn't correct
9 Incorrect 95 ms 508 KB Output isn't correct
10 Incorrect 115 ms 336 KB Output isn't correct
11 Incorrect 148 ms 336 KB Output isn't correct
12 Incorrect 911 ms 336 KB Output isn't correct
13 Incorrect 230 ms 336 KB Output isn't correct
14 Execution timed out 1010 ms 336 KB Time limit exceeded
15 Execution timed out 1041 ms 336 KB Time limit exceeded
16 Execution timed out 1060 ms 336 KB Time limit exceeded
17 Execution timed out 1055 ms 336 KB Time limit exceeded
18 Execution timed out 1041 ms 336 KB Time limit exceeded
19 Execution timed out 1034 ms 336 KB Time limit exceeded
20 Execution timed out 1038 ms 504 KB Time limit exceeded
21 Execution timed out 1076 ms 336 KB Time limit exceeded
22 Execution timed out 1046 ms 336 KB Time limit exceeded
23 Execution timed out 1043 ms 336 KB Time limit exceeded
24 Execution timed out 1069 ms 336 KB Time limit exceeded
25 Execution timed out 1036 ms 336 KB Time limit exceeded
26 Execution timed out 1056 ms 336 KB Time limit exceeded
27 Execution timed out 1064 ms 336 KB Time limit exceeded
28 Execution timed out 1053 ms 336 KB Time limit exceeded
29 Execution timed out 1063 ms 336 KB Time limit exceeded
30 Execution timed out 1059 ms 336 KB Time limit exceeded
31 Execution timed out 1056 ms 336 KB Time limit exceeded
32 Execution timed out 1056 ms 336 KB Time limit exceeded
33 Execution timed out 1066 ms 336 KB Time limit exceeded
34 Execution timed out 1038 ms 512 KB Time limit exceeded
35 Execution timed out 1078 ms 336 KB Time limit exceeded
36 Execution timed out 1038 ms 336 KB Time limit exceeded
37 Execution timed out 1081 ms 336 KB Time limit exceeded
38 Execution timed out 1073 ms 336 KB Time limit exceeded
39 Execution timed out 1053 ms 336 KB Time limit exceeded
40 Execution timed out 1052 ms 336 KB Time limit exceeded
41 Execution timed out 1064 ms 336 KB Time limit exceeded
42 Execution timed out 1082 ms 420 KB Time limit exceeded
43 Execution timed out 1046 ms 336 KB Time limit exceeded
44 Execution timed out 1075 ms 336 KB Time limit exceeded
45 Execution timed out 1072 ms 336 KB Time limit exceeded