| Task: | Toistot |
| Sender: | sharph2 |
| Submission time: | 2025-12-20 17:02:36 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 63 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 11 |
| #2 | ACCEPTED | 21 |
| #3 | ACCEPTED | 31 |
| #4 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | 1, 2, 3, 4 | details |
| #2 | ACCEPTED | 0.01 s | 2, 3, 4 | details |
| #3 | ACCEPTED | 0.01 s | 3, 4 | details |
| #4 | WRONG ANSWER | 0.01 s | 4 | details |
| #5 | ACCEPTED | 0.01 s | 1, 2, 3, 4 | details |
| #6 | WRONG ANSWER | 0.01 s | 4 | details |
Code
#include <algorithm>
#include <array>
#include <iostream>
#include <climits>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <vector>
using namespace std;
using Z = long long int;
int main() {
cin.sync_with_stdio(false);
cin.tie(nullptr);
vector<Z> all;
for(Z len = 1, start = 1, end = 10; len <= 4; ++len, start *= 10, end *= 10) {
Z repCoef = 1;
for(Z rep = 2; rep * len <= 9; ++rep) {
repCoef = end * repCoef + 1;
for(Z pattern = start; pattern < end; ++pattern) {
Z val = repCoef * pattern;
all.push_back(val);
}
}
}
sort(all.begin(), all.end());
all.erase(unique(all.begin(), all.end()), all.end());
Z tc;
cin >> tc;
for(Z ti = 0; ti < tc; ++ti) {
Z a, b;
cin >> a >> b;
cout << upper_bound(all.begin(), all.end(), b) - lower_bound(all.begin(), all.end(), a) << "\n";
}
return 0;
}
Test details
Test 1
Group: 1, 2, 3, 4
Verdict: ACCEPTED
| input |
|---|
| 1000 633 906 727 914 585 884 750 792 ... |
| correct output |
|---|
| 3 2 2 1 0 ... |
| user output |
|---|
| 3 2 2 1 0 ... |
Test 2
Group: 2, 3, 4
Verdict: ACCEPTED
| input |
|---|
| 1000 647761 927345 744364 840268 598715 905836 767448 810881 ... |
| correct output |
|---|
| 303 105 333 48 95 ... |
| user output |
|---|
| 303 105 333 48 95 ... |
Test 3
Group: 3, 4
Verdict: ACCEPTED
| input |
|---|
| 1000 663307073 949601845 762227828 860434499 613084013 927576203 785866095 830342436 ... |
| correct output |
|---|
| 286 98 314 44 89 ... |
| user output |
|---|
| 286 98 314 44 89 ... |
Test 4
Group: 4
Verdict: WRONG ANSWER
| input |
|---|
| 1000 818435896335669158 98300938101... |
| correct output |
|---|
| 164737893 96015818 103821980 402263734 52636276 ... |
| user output |
|---|
| 0 0 0 0 0 ... |
Feedback: Incorrect character on line 1 col 1: expected "164737893", got "0"
Test 5
Group: 1, 2, 3, 4
Verdict: ACCEPTED
| input |
|---|
| 990 1 1 1 2 1 3 1 4 ... |
| correct output |
|---|
| 0 0 0 0 0 ... |
| user output |
|---|
| 0 0 0 0 0 ... |
Test 6
Group: 4
Verdict: WRONG ANSWER
| input |
|---|
| 961 1 1000000000000000000 1 999999999999999999 1 999999999999999998 1 999999999999999997 ... |
| correct output |
|---|
| 1001000097 1001000097 1001000096 1001000096 1001000096 ... |
| user output |
|---|
| 11007 11007 11007 11007 11007 ... |
Feedback: Incorrect character on line 1 col 2: expected "1001000097", got "11007"
