Submission #1120344

#TimeUsernameProblemLanguageResultExecution timeMemory
1120344vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
21.25 / 100
1088 ms508 KiB
#include <bits/stdc++.h> using namespace std; #define SPEED \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); #define pb push_back #define endl "\n" #define ALL(x) x.begin(), x.end() #define intt long long const intt mxN = 2e5 + 5; void solve() { intt a, b; cin >> a >> b; intt ans = 0; vector<intt> arr; for(intt cur = a; cur <= b; cur++) { intt eded = cur; vector<intt>hmm; while(eded) { hmm.pb(eded % 10); eded /= 10; } if(hmm.size() == 1) continue; if(hmm.size() == 2) continue; if(hmm.size() == 3) { if(hmm[0] == hmm[1] || hmm[1] == hmm[2] || hmm[0] == hmm[2]) { continue; } else { ans++; continue; } } for(intt i = 1; i < hmm.size(); i++) { if(hmm[i] == hmm[i-1]) { continue; } } bool ok = true; for(intt i = 0; i < hmm.size(); i++) { for(intt j = i + 1; j < hmm.size(); j++) { intt ind = 0; bool is = true; while(i + ind < j - ind) { if(hmm[i + ind] != hmm[j-ind]){ is = false; break; } ind++; } if(is) { ok = false; break; } } if(!ok) break; } if(ok){ ans++; } } cout << ans << endl; } int main(){ SPEED; int tst = 1, i = 1; // cin >> tst; while(tst--) { solve(); } return 0; }

Compilation message (stderr)

numbers.cpp: In function 'void solve()':
numbers.cpp:38:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(intt i = 1; i < hmm.size(); i++) {
      |                         ~~^~~~~~~~~~~~
numbers.cpp:44:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         for(intt i = 0; i < hmm.size(); i++) {
      |                         ~~^~~~~~~~~~~~
numbers.cpp:45:35: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |             for(intt j = i + 1; j < hmm.size(); j++) {
      |                                 ~~^~~~~~~~~~~~
numbers.cpp: In function 'int main()':
numbers.cpp:71:18: warning: unused variable 'i' [-Wunused-variable]
   71 |     int tst = 1, i = 1;
      |                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...