답안 #755433

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755433 2023-06-10T05:50:30 Z The_Samurai Palindrome-Free Numbers (BOI13_numbers) C++17
36.6667 / 100
1000 ms 296 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

bool check(ll n) {
    string s = to_string(n);
    for (int i = 0; i < s.size(); i++) {
        if (i + 1 < s.size() and s[i] == s[i + 1]) return false;
        if (i + 2 < s.size() and s[i] == s[i + 2]) return false;
    }
    return true;
}

int get(ll l, ll r) {
    int ans = 0;
    for (ll i = l; i <= r; i++) ans += check(i);
    return ans;
}

ll get(ll n) {
    if (n < 0) return 0;
    if (n < 10) return n + 1;
    ll ans = 10;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    ll l, r;
    cin >> l >> r;
    cout << get(l, r);

    return 0;
}

Compilation message

numbers.cpp: In function 'bool check(ll)':
numbers.cpp:8:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i = 0; i < s.size(); i++) {
      |                     ~~^~~~~~~~~~
numbers.cpp:9:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |         if (i + 1 < s.size() and s[i] == s[i + 1]) return false;
      |             ~~~~~~^~~~~~~~~~
numbers.cpp:10:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |         if (i + 2 < s.size() and s[i] == s[i + 2]) return false;
      |             ~~~~~~^~~~~~~~~~
numbers.cpp: In function 'll get(ll)':
numbers.cpp:24:8: warning: unused variable 'ans' [-Wunused-variable]
   24 |     ll ans = 10;
      |        ^~~
numbers.cpp:24:8: warning: control reaches end of non-void function [-Wreturn-type]
   24 |     ll ans = 10;
      |        ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 8 ms 212 KB Output is correct
4 Correct 5 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 280 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 3 ms 212 KB Output is correct
15 Correct 3 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 8 ms 212 KB Output is correct
20 Correct 3 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 193 ms 296 KB Output is correct
2 Execution timed out 1081 ms 212 KB Time limit exceeded
3 Execution timed out 1052 ms 212 KB Time limit exceeded
4 Execution timed out 1045 ms 212 KB Time limit exceeded
5 Execution timed out 1083 ms 212 KB Time limit exceeded
6 Execution timed out 1079 ms 212 KB Time limit exceeded
7 Correct 82 ms 212 KB Output is correct
8 Correct 63 ms 296 KB Output is correct
9 Correct 106 ms 296 KB Output is correct
10 Correct 150 ms 212 KB Output is correct
11 Correct 191 ms 296 KB Output is correct
12 Execution timed out 1040 ms 212 KB Time limit exceeded
13 Correct 231 ms 292 KB Output is correct
14 Execution timed out 1093 ms 212 KB Time limit exceeded
15 Execution timed out 1077 ms 212 KB Time limit exceeded
16 Execution timed out 1082 ms 212 KB Time limit exceeded
17 Execution timed out 1084 ms 212 KB Time limit exceeded
18 Execution timed out 1076 ms 212 KB Time limit exceeded
19 Execution timed out 1073 ms 212 KB Time limit exceeded
20 Execution timed out 1078 ms 212 KB Time limit exceeded
21 Execution timed out 1076 ms 212 KB Time limit exceeded
22 Execution timed out 1075 ms 212 KB Time limit exceeded
23 Execution timed out 1083 ms 212 KB Time limit exceeded
24 Execution timed out 1072 ms 212 KB Time limit exceeded
25 Execution timed out 1077 ms 212 KB Time limit exceeded
26 Execution timed out 1083 ms 212 KB Time limit exceeded
27 Execution timed out 1081 ms 212 KB Time limit exceeded
28 Execution timed out 1083 ms 212 KB Time limit exceeded
29 Execution timed out 1081 ms 212 KB Time limit exceeded
30 Execution timed out 1087 ms 212 KB Time limit exceeded
31 Execution timed out 1088 ms 212 KB Time limit exceeded
32 Execution timed out 1086 ms 212 KB Time limit exceeded
33 Execution timed out 1079 ms 212 KB Time limit exceeded
34 Execution timed out 1081 ms 212 KB Time limit exceeded
35 Execution timed out 1055 ms 212 KB Time limit exceeded
36 Execution timed out 1087 ms 212 KB Time limit exceeded
37 Execution timed out 1084 ms 212 KB Time limit exceeded
38 Execution timed out 1078 ms 212 KB Time limit exceeded
39 Execution timed out 1079 ms 212 KB Time limit exceeded
40 Execution timed out 1082 ms 212 KB Time limit exceeded
41 Execution timed out 1078 ms 212 KB Time limit exceeded
42 Execution timed out 1075 ms 212 KB Time limit exceeded
43 Execution timed out 1079 ms 212 KB Time limit exceeded
44 Execution timed out 1079 ms 212 KB Time limit exceeded
45 Execution timed out 1078 ms 212 KB Time limit exceeded