Submission #1120839

#TimeUsernameProblemLanguageResultExecution timeMemory
1120839vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
28.33 / 100
1088 ms512 KiB
#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; bool free(ll n){ string s = to_string(n); for(int i = 0; i < s.size(); i++){ for(int j = i + 1; j < s.size(); j++){ string neww = s.substr(i, j - i + 1); string e = neww; reverse(all(neww)); if(neww == e){ return false; } } } return true; } void solve(){ ll a,b; cin >> a >> b; ll cnt = 0; for(ll i = a; i <= b; i++){ if(free(i)){ cnt++; } } cout << cnt << endl; } int main(){ fast; solve(); return 0; }

Compilation message (stderr)

numbers.cpp: In function 'bool free(long long int)':
numbers.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i = 0; i < s.size(); i++){
      |                    ~~^~~~~~~~~~
numbers.cpp:18:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for(int j = i + 1; j < s.size(); j++){
      |                            ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...