답안 #1120264

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1120264 2024-11-28T06:48:12 Z vjudge1 Palindrome-Free Numbers (BOI13_numbers) C++17
11.6667 / 100
1000 ms 512 KB
#include "bits/stdc++.h"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pb push_back
#define in insert
#define F first
#define S second
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define endl '\n'
#define pii pair<ll,ll>
using namespace std;
const ll INF =1e18, mod = 1e9 + 7, N = 1e5 + 5;
void solve(){
    ll a,b;
    cin >> a >> b;
    ll cnt = 0;
    for(int i = a; i <= b; i++){
        string s = to_string(i);
        bool test = true;
        if(s.size() == 2){
            if(s[0] == s[1]){
                cnt++;
                continue;
            }
        }
        if(s.size() ==1){
            continue;
        }
        string s1 = "";
        string s2 = "";
        for(int i = 0; i < s.size() - 1; i++){
            s1 = "";
            s1 += s[i];
            for(int j = i + 1; j < s.size(); j++){
                s1 += s[j];
                string neww = s1;
                reverse(all(neww));
                if(neww == s1){
                    test = false;
                    break;
                }
            }
            if(!test){
                break;
            }
        }
        if(test){
            cnt++;
        }
    }
    cout << cnt << endl;
}
int main(){
    fast;
   // ll t = 1;
    //cin >> t;  
 //   while(t--){
        solve();
 //   }
    return 0;
}

Compilation message

numbers.cpp: In function 'void solve()':
numbers.cpp:32:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for(int i = 0; i < s.size() - 1; i++){
      |                        ~~^~~~~~~~~~~~~~
numbers.cpp:35:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             for(int j = i + 1; j < s.size(); j++){
      |                                ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Execution timed out 1061 ms 336 KB Time limit exceeded
4 Incorrect 23 ms 508 KB Output isn't correct
5 Incorrect 1 ms 336 KB Output isn't correct
6 Correct 1 ms 336 KB Output is correct
7 Incorrect 1 ms 508 KB Output isn't correct
8 Incorrect 1 ms 336 KB Output isn't correct
9 Incorrect 1 ms 336 KB Output isn't 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 23 ms 336 KB Output isn't correct
15 Correct 24 ms 464 KB Output is correct
16 Correct 2 ms 336 KB Output is correct
17 Correct 8 ms 336 KB Output is correct
18 Incorrect 1 ms 336 KB Output isn't correct
19 Execution timed out 1044 ms 336 KB Time limit exceeded
20 Incorrect 22 ms 336 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1040 ms 336 KB Time limit exceeded
2 Execution timed out 1069 ms 336 KB Time limit exceeded
3 Execution timed out 1048 ms 336 KB Time limit exceeded
4 Execution timed out 1042 ms 336 KB Time limit exceeded
5 Execution timed out 1074 ms 336 KB Time limit exceeded
6 Execution timed out 1061 ms 336 KB Time limit exceeded
7 Execution timed out 1063 ms 336 KB Time limit exceeded
8 Correct 781 ms 336 KB Output is correct
9 Execution timed out 1063 ms 336 KB Time limit exceeded
10 Execution timed out 1032 ms 336 KB Time limit exceeded
11 Execution timed out 1058 ms 336 KB Time limit exceeded
12 Execution timed out 1043 ms 336 KB Time limit exceeded
13 Execution timed out 1038 ms 336 KB Time limit exceeded
14 Execution timed out 1054 ms 336 KB Time limit exceeded
15 Execution timed out 1036 ms 336 KB Time limit exceeded
16 Execution timed out 1076 ms 336 KB Time limit exceeded
17 Execution timed out 1055 ms 336 KB Time limit exceeded
18 Execution timed out 1042 ms 512 KB Time limit exceeded
19 Execution timed out 1031 ms 336 KB Time limit exceeded
20 Execution timed out 1065 ms 336 KB Time limit exceeded
21 Execution timed out 1018 ms 336 KB Time limit exceeded
22 Execution timed out 1042 ms 504 KB Time limit exceeded
23 Execution timed out 1074 ms 336 KB Time limit exceeded
24 Execution timed out 1059 ms 336 KB Time limit exceeded
25 Execution timed out 1065 ms 336 KB Time limit exceeded
26 Execution timed out 1054 ms 336 KB Time limit exceeded
27 Execution timed out 1068 ms 336 KB Time limit exceeded
28 Execution timed out 1047 ms 336 KB Time limit exceeded
29 Execution timed out 1049 ms 336 KB Time limit exceeded
30 Execution timed out 1032 ms 336 KB Time limit exceeded
31 Execution timed out 1053 ms 336 KB Time limit exceeded
32 Execution timed out 1057 ms 336 KB Time limit exceeded
33 Execution timed out 1034 ms 336 KB Time limit exceeded
34 Execution timed out 1054 ms 336 KB Time limit exceeded
35 Execution timed out 1050 ms 336 KB Time limit exceeded
36 Execution timed out 1067 ms 336 KB Time limit exceeded
37 Execution timed out 1066 ms 336 KB Time limit exceeded
38 Execution timed out 1061 ms 336 KB Time limit exceeded
39 Execution timed out 1060 ms 336 KB Time limit exceeded
40 Execution timed out 1059 ms 336 KB Time limit exceeded
41 Execution timed out 1046 ms 336 KB Time limit exceeded
42 Execution timed out 1061 ms 336 KB Time limit exceeded
43 Execution timed out 1056 ms 336 KB Time limit exceeded
44 Execution timed out 1049 ms 336 KB Time limit exceeded
45 Execution timed out 1073 ms 336 KB Time limit exceeded