Submission details
Task:Toistot
Sender:Lieska
Submission time:2025-12-20 15:33:00 +0200
Language:C++ (C++20)
Status:READY
Result:63
Feedback
groupverdictscore
#1ACCEPTED11
#2ACCEPTED21
#3ACCEPTED31
#40
Test results
testverdicttimegroup
#1ACCEPTED0.10 s1, 2, 3, 4details
#2ACCEPTED0.10 s2, 3, 4details
#3ACCEPTED0.11 s3, 4details
#40.11 s4details
#5ACCEPTED0.10 s1, 2, 3, 4details
#60.10 s4details

Code

//////// From bqi343
 
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python! //
 
// pairs
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;
#define mp make_pair
#define f first
#define s second
 
#define tcT template<class T
#define tcTU tcT, class U
// ^ lol this makes everything look weird but I'll try it
tcT> using V = vector<T>; 
tcT, size_t SZ> using AR = array<T,SZ>; 
using vi = V<int>;
using vb = V<bool>;
using vl = V<ll>;
using vd = V<db>;
using vs = V<str>;
using vpi = V<pi>;
using vpl = V<pl>;
using vpd = V<pd>;
 
// vectors
// oops size(x), rbegin(x), rend(x) need C++17
#define sz(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define rall(x) x.rbegin(), x.rend() 
#define sor(x) sort(all(x)) 
#define rsz resize
#define ins insert 
#define pb push_back
#define eb emplace_back
#define ft front()
#define bk back()
 
#define lb lower_bound
#define ub upper_bound
tcT> int lwb(V<T>& a, const T& b) { return int(lb(all(a),b)-bg(a)); }
tcT> int upb(V<T>& a, const T& b) { return int(ub(all(a),b)-bg(a)); }
 
// loops
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define rep(a) F0R(_,a)
#define each(a,x) for (auto& a: x)
 
const int MOD = (int)1e9+7; // 998244353;
const int MX = (int)2e5+5;
const ll BIG = 1e18; // not too close to LLONG_MAX
const db PI = acos((db)-1);
const int dx[4]{1,0,-1,0}, dy[4]{0,1,0,-1}; // for every grid problem!!
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;
 
// bitwise ops
// also see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
constexpr int pct(int x) { return __builtin_popcount(x); } // # of bits set
constexpr int bits(int x) { // assert(x >= 0); // make C++11 compatible until USACO updates ...
	return x == 0 ? 0 : 31-__builtin_clz(x); } // floor(log2(x)) 
constexpr int p2(int x) { return 1<<x; }
constexpr int msk2(int x) { return p2(x)-1; }
 
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
 
tcT> bool ckmin(T& a, const T& b) {
	return b < a ? a = b, 1 : 0; } // set a = min(a,b)
tcT> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; } // set a = max(a,b)
 
tcTU> T fstTrue(T lo, T hi, U f) {
	++hi; assert(lo <= hi); // assuming f is increasing
	while (lo < hi) { // find first index such that f is true 
		T mid = lo+(hi-lo)/2;
		f(mid) ? hi = mid : lo = mid+1; 
	} 
	return lo;
}
tcTU> T lstTrue(T lo, T hi, U f) {
	--lo; assert(lo <= hi); // assuming f is decreasing
	while (lo < hi) { // find first index such that f is true 
		T mid = lo+(hi-lo+1)/2;
		f(mid) ? lo = mid : hi = mid-1;
	} 
	return lo;
}
tcT> void remDup(vector<T>& v) { // sort and remove duplicates
	sort(all(v)); v.erase(unique(all(v)),end(v)); }
tcTU> void erase(T& t, const U& u) { // don't erase
	auto it = t.find(u); assert(it != end(t));
	t.erase(it); } // element that doesn't exist from (multi)set

set<ll> se;

void test(){
    ll a, b;
    cin >> a >> b;
    int cnt = 0;
    for (auto u:se){
        if (u >= a && u <= b) cnt++;
    }
    cout << cnt << "\n";
}


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    for (ll i=1; i<=9999; ++i){
        string s1 = to_string(i);
        string s2=s1;
        for (int j=2; j<=9; ++j){
            s2+=s1;
            if (s2.size()<=9){
                int b = stoi(s2);
                se.insert(b);
            }
        }
    }
    int tt;
    cin >> tt;
    while (tt--) test();
}

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:

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:

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"