답안 #977113

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
977113 2024-05-07T11:51:03 Z VMaksimoski008 Palindrome-Free Numbers (BOI13_numbers) C++17
38.3333 / 100
1000 ms 756 KB
#include <bits/stdc++.h>

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
//#define int long long

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
const double eps = 1e-9;

int32_t main() {
    ll a, b, ans=0;
    cin >> a >> b;

    for(ll i=a; i<=b; i++) {
        bool ok = 1;
        string s = to_string(i);
        for(int j=0; j+1<s.size(); j++) {
            if(s[j] == s[j+1]) ok = 0;
            if(j+2 < s.size() && s[j] == s[j+2]) ok = 0;
        }
        ans += ok;
    }

    cout << ans << '\n';
    return 0;
}

Compilation message

numbers.cpp: In function 'int32_t main()':
numbers.cpp:28:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for(int j=0; j+1<s.size(); j++) {
      |                      ~~~^~~~~~~~~
numbers.cpp:30:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             if(j+2 < s.size() && s[j] == s[j+2]) ok = 0;
      |                ~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 5 ms 600 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 500 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 6 ms 348 KB Output is correct
20 Correct 2 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 344 KB Output is correct
2 Execution timed out 1044 ms 344 KB Time limit exceeded
3 Execution timed out 1054 ms 348 KB Time limit exceeded
4 Execution timed out 1027 ms 344 KB Time limit exceeded
5 Execution timed out 1033 ms 348 KB Time limit exceeded
6 Execution timed out 1062 ms 348 KB Time limit exceeded
7 Correct 53 ms 412 KB Output is correct
8 Correct 39 ms 412 KB Output is correct
9 Correct 68 ms 348 KB Output is correct
10 Correct 94 ms 344 KB Output is correct
11 Correct 140 ms 408 KB Output is correct
12 Correct 766 ms 412 KB Output is correct
13 Correct 180 ms 344 KB Output is correct
14 Execution timed out 1049 ms 344 KB Time limit exceeded
15 Execution timed out 1043 ms 344 KB Time limit exceeded
16 Execution timed out 1067 ms 348 KB Time limit exceeded
17 Execution timed out 1016 ms 348 KB Time limit exceeded
18 Execution timed out 1047 ms 344 KB Time limit exceeded
19 Execution timed out 1062 ms 348 KB Time limit exceeded
20 Execution timed out 1071 ms 348 KB Time limit exceeded
21 Execution timed out 1054 ms 348 KB Time limit exceeded
22 Execution timed out 1056 ms 348 KB Time limit exceeded
23 Execution timed out 1041 ms 344 KB Time limit exceeded
24 Execution timed out 1056 ms 348 KB Time limit exceeded
25 Execution timed out 1040 ms 348 KB Time limit exceeded
26 Execution timed out 1046 ms 348 KB Time limit exceeded
27 Execution timed out 1051 ms 344 KB Time limit exceeded
28 Execution timed out 1012 ms 344 KB Time limit exceeded
29 Execution timed out 1054 ms 348 KB Time limit exceeded
30 Execution timed out 1054 ms 348 KB Time limit exceeded
31 Execution timed out 1046 ms 344 KB Time limit exceeded
32 Execution timed out 1025 ms 344 KB Time limit exceeded
33 Execution timed out 1041 ms 344 KB Time limit exceeded
34 Execution timed out 1065 ms 348 KB Time limit exceeded
35 Execution timed out 1049 ms 348 KB Time limit exceeded
36 Execution timed out 1031 ms 344 KB Time limit exceeded
37 Execution timed out 1014 ms 344 KB Time limit exceeded
38 Execution timed out 1032 ms 756 KB Time limit exceeded
39 Execution timed out 1050 ms 348 KB Time limit exceeded
40 Execution timed out 1065 ms 348 KB Time limit exceeded
41 Execution timed out 1031 ms 344 KB Time limit exceeded
42 Execution timed out 1043 ms 348 KB Time limit exceeded
43 Execution timed out 1054 ms 344 KB Time limit exceeded
44 Execution timed out 1044 ms 344 KB Time limit exceeded
45 Execution timed out 1083 ms 344 KB Time limit exceeded