# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
796248 | 2023-07-28T08:20:08 Z | duyanhloveav | Palindrome-Free Numbers (BOI13_numbers) | C++17 | 1000 ms | 304 KB |
#include <bits/stdc++.h> using namespace std; const int N = 9 + 1e6; const long long oo = 7 + 1e18; #pragma GCC optimize("Ofast,O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") long long pw[20]; string tostring(long long x) { string s; while (x > 0) { s = s + (char)(x % 10 + '0'); x /= 10; } reverse(begin(s), end(s)); return s; } void SaKaTa() { long long a, b; scanf("%lld%lld", &a, &b); pw[0] = 1; for (int i = 1; i <= 18; i++) { pw[i] = pw[i - 1] * 10; } long long ans = 0; // check (s[i], s[i + 1]), (s[i], s[i + 2]) for (long long i = a; i <= b;) { string s = to_string(i); s = s + 's'; long long check = -oo; for (int j = 0; j < s.size() - 2; j++) { if (s[j] == s[j + 1]) { check = s.size() - (j + 1) - 2; break; } else if (s[j] == s[j + 2]) { check = s.size() - (j + 2) - 2; break; } } if (check == -oo) { ++ans; check = 0; } i = (i / pw[check] * pw[check]) + pw[check]; } printf("%lld", ans); } int32_t main() { #define TASKNAME "NPAL" cin.tie(0)->sync_with_stdio(0); if ( fopen( TASKNAME".inp", "r" ) ) { freopen (TASKNAME".inp", "r", stdin); freopen (TASKNAME".out", "w", stdout); } int testcase = 1; // scanf("%d", &testcase); while (testcase--) SaKaTa(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 4 ms | 212 KB | Output is correct |
4 | Correct | 3 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 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 | 0 ms | 212 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 | 2 ms | 212 KB | Output is correct |
15 | Correct | 3 ms | 212 KB | Output is correct |
16 | Correct | 0 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 | 4 ms | 212 KB | Output is correct |
20 | Correct | 2 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 105 ms | 212 KB | Output is correct |
2 | Execution timed out | 1074 ms | 212 KB | Time limit exceeded |
3 | Execution timed out | 1079 ms | 212 KB | Time limit exceeded |
4 | Execution timed out | 1077 ms | 212 KB | Time limit exceeded |
5 | Correct | 893 ms | 300 KB | Output is correct |
6 | Correct | 895 ms | 304 KB | Output is correct |
7 | Correct | 52 ms | 296 KB | Output is correct |
8 | Correct | 38 ms | 300 KB | Output is correct |
9 | Correct | 68 ms | 212 KB | Output is correct |
10 | Correct | 88 ms | 212 KB | Output is correct |
11 | Correct | 88 ms | 304 KB | Output is correct |
12 | Correct | 526 ms | 300 KB | Output is correct |
13 | Correct | 137 ms | 300 KB | Output is correct |
14 | Correct | 896 ms | 304 KB | Output is correct |
15 | Execution timed out | 1020 ms | 212 KB | Time limit exceeded |
16 | Execution timed out | 1052 ms | 212 KB | Time limit exceeded |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Execution timed out | 1087 ms | 212 KB | Time limit exceeded |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Execution timed out | 1075 ms | 212 KB | Time limit exceeded |
24 | Correct | 1 ms | 212 KB | Output is correct |
25 | Execution timed out | 1080 ms | 212 KB | Time limit exceeded |
26 | Execution timed out | 1081 ms | 212 KB | Time limit exceeded |
27 | Execution timed out | 1080 ms | 212 KB | Time limit exceeded |
28 | Execution timed out | 1086 ms | 212 KB | Time limit exceeded |
29 | Correct | 0 ms | 212 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Execution timed out | 1087 ms | 212 KB | Time limit exceeded |
32 | Correct | 0 ms | 212 KB | Output is correct |
33 | Execution timed out | 1090 ms | 212 KB | Time limit exceeded |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Execution timed out | 1065 ms | 212 KB | Time limit exceeded |
36 | Execution timed out | 1073 ms | 212 KB | Time limit exceeded |
37 | Execution timed out | 1079 ms | 212 KB | Time limit exceeded |
38 | Execution timed out | 1074 ms | 212 KB | Time limit exceeded |
39 | Execution timed out | 1079 ms | 212 KB | Time limit exceeded |
40 | Correct | 1 ms | 212 KB | Output is correct |
41 | Execution timed out | 1075 ms | 212 KB | Time limit exceeded |
42 | Correct | 0 ms | 212 KB | Output is correct |
43 | Execution timed out | 1072 ms | 212 KB | Time limit exceeded |
44 | Execution timed out | 1069 ms | 212 KB | Time limit exceeded |
45 | Execution timed out | 1048 ms | 212 KB | Time limit exceeded |