| Task: | Toistot |
| Sender: | Sisuaski |
| Submission time: | 2025-12-20 16:01:14 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 11 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 11 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| #4 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | 1, 2, 3, 4 | details |
| #2 | WRONG ANSWER | 0.01 s | 2, 3, 4 | details |
| #3 | WRONG ANSWER | 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 <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll rep(ll x, int n) {
ll k=1;
while(k<=x) k*=10;
ll r=0;
const ll M = 2e18;
ll mk = M/k;
for(int i=0; i<n; ++i) {
//if (k*r > M)
if (r > mk) return M;
r = k*r + x;
}
return r;
}
ll maxV(ll t, int n) {
ll hi=1;
while(rep(hi,n)<=t) hi*=2;
ll low=0;
while(hi-low>1) {
ll m=(low+hi)/2;
if (rep(m,n)<=t) low=m;
else hi=m;
}
return low;
}
ll minV(ll t, int n) {
ll hi=1;
while(rep(hi,n)<t) hi*=2;
ll low=0;
while(hi-low>1) {
ll m=(low+hi)/2;
if (rep(m,n)<t) low=m;
else hi=m;
}
return hi;
}
const int ps[] = {2,3,5,7,11,13,17};
int main() {
int t;cin>>t;
while(t--) {
ll a,b;cin>>a>>b;
ll res=0;
for(int k: ps) {
ll x = minV(a,k);
ll y = maxV(b,k);
if (y>=x) res += y-x+1;
}
cout<<res<<'\n';
}
}
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: WRONG ANSWER
| input |
|---|
| 1000 647761 927345 744364 840268 598715 905836 767448 810881 ... |
| correct output |
|---|
| 303 105 333 48 95 ... |
| user output |
|---|
| 306 106 336 49 96 ... |
Feedback: Incorrect character on line 1 col 3: expected "303", got "306"
Test 3
Group: 3, 4
Verdict: WRONG ANSWER
| input |
|---|
| 1000 663307073 949601845 762227828 860434499 613084013 927576203 785866095 830342436 ... |
| correct output |
|---|
| 286 98 314 44 89 ... |
| user output |
|---|
| 286 98 314 44 89 ... |
Feedback: Incorrect character on line 225 col 4: expected "10548", got "10556"
Test 4
Group: 4
Verdict: WRONG ANSWER
| input |
|---|
| 1000 818435896335669158 98300938101... |
| correct output |
|---|
| 164737893 96015818 103821980 402263734 52636276 ... |
| user output |
|---|
| 164738058 96015914 103822083 402264136 52636328 ... |
Feedback: Incorrect character on line 1 col 6: expected "164737893", got "164738058"
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 |
|---|
| 1001001123 1001001123 1001001121 1001001121 1001001121 ... |
Feedback: Incorrect character on line 1 col 7: expected "1001000097", got "1001001123"
