답안 #1120185

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1120185 2024-11-28T06:25:53 Z vjudge1 Palindrome-Free Numbers (BOI13_numbers) C++17
44.1667 / 100
1000 ms 592 KB
#include <bits/stdc++.h>
using namespace std;

bool isPalindrome(const string &str) {
  string s1 = str.substr(0, str.size() / 2 + str.size() % 2);
  string s2 = str.substr(str.size() / 2);
  reverse(s2.begin(), s2.end());
  return s1 == s2;
}

template <typename func> bool forAll(const string &str, const func &f) {
  for (size_t i = 0; i < str.size(); i++) {
    for (size_t j = 2; j <= str.size() - i; j++) {
      string substr = str.substr(i, j);
      if (f(substr)) {
        return false;
      }
    }
  }
  return true;
}

int main() {
  int a, b, ans = 0;
  cin >> a >> b;
  for (int i = a; i <= b; i++) {
    string str = to_string(i);
    if (forAll(str, isPalindrome)) {
      ans++;
    }
  }
  cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Incorrect 1 ms 336 KB Output isn't correct
4 Correct 18 ms 336 KB Output is 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 508 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 504 KB Output is correct
14 Correct 26 ms 436 KB Output is correct
15 Correct 18 ms 432 KB Output is correct
16 Correct 2 ms 336 KB Output is correct
17 Correct 12 ms 336 KB Output is correct
18 Correct 1 ms 592 KB Output is correct
19 Incorrect 1 ms 336 KB Output isn't correct
20 Correct 19 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1040 ms 336 KB Time limit exceeded
2 Incorrect 1 ms 336 KB Output isn't correct
3 Incorrect 1 ms 336 KB Output isn't correct
4 Incorrect 1 ms 336 KB Output isn't correct
5 Execution timed out 1097 ms 336 KB Time limit exceeded
6 Execution timed out 1069 ms 336 KB Time limit exceeded
7 Execution timed out 1036 ms 336 KB Time limit exceeded
8 Correct 750 ms 424 KB Output is correct
9 Execution timed out 1032 ms 336 KB Time limit exceeded
10 Execution timed out 1040 ms 336 KB Time limit exceeded
11 Execution timed out 1044 ms 336 KB Time limit exceeded
12 Execution timed out 1039 ms 336 KB Time limit exceeded
13 Execution timed out 1052 ms 336 KB Time limit exceeded
14 Execution timed out 1057 ms 336 KB Time limit exceeded
15 Execution timed out 1032 ms 504 KB Time limit exceeded
16 Incorrect 1 ms 336 KB Output isn't correct
17 Correct 2 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 512 KB Output is correct
21 Incorrect 1 ms 336 KB Output isn't correct
22 Correct 1 ms 336 KB Output is correct
23 Incorrect 1 ms 336 KB Output isn't correct
24 Correct 1 ms 336 KB Output is correct
25 Incorrect 1 ms 336 KB Output isn't correct
26 Incorrect 1 ms 336 KB Output isn't correct
27 Incorrect 1 ms 336 KB Output isn't correct
28 Incorrect 1 ms 336 KB Output isn't correct
29 Correct 1 ms 428 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Incorrect 1 ms 504 KB Output isn't correct
32 Correct 1 ms 504 KB Output is correct
33 Incorrect 1 ms 336 KB Output isn't correct
34 Correct 1 ms 336 KB Output is correct
35 Incorrect 1 ms 336 KB Output isn't correct
36 Incorrect 1 ms 336 KB Output isn't correct
37 Incorrect 1 ms 336 KB Output isn't correct
38 Incorrect 1 ms 336 KB Output isn't correct
39 Incorrect 1 ms 336 KB Output isn't correct
40 Correct 1 ms 336 KB Output is correct
41 Incorrect 1 ms 336 KB Output isn't correct
42 Correct 1 ms 336 KB Output is correct
43 Incorrect 1 ms 336 KB Output isn't correct
44 Incorrect 1 ms 336 KB Output isn't correct
45 Incorrect 1 ms 336 KB Output isn't correct