QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#110109 | #2001. Tropical Garden | minhcool# | 100 ✓ | 1009ms | 62012kb | C++20 | 3.8kb | 2023-05-31 15:47:22 | 2024-05-31 13:52:33 |
Judging History
answer
#include "garden.h"
#include "gardenlib.h"
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
//#define ll long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
/*
Algo: We have 2n nodes (i, 0/1 - is last node the largest)
Just for lmao
*/
typedef pair<ll, ll> ii;
typedef pair<ii, ll> iii;
typedef pair<ii, ii> iiii;
const ll N = 3e5 + 5;
const ll oo = 1e18 + 7, mod = 1e9 + 7;
mt19937 rng(1);
ll rnd(ll l, ll r){
ll temp = rng() % (r - l + 1);
return abs(temp) + l;
}
ll n, m, p, q;
vector<ll> Adj[N];
// cycles that node u can get
vector<ii> cyc[N][2];
//map<ii, ll> mp;
ii nxt[N][2];
ll mn_dist[N][2];
vector<ii> Adj2[N][2];
iiii savee[N];
void count_routes(int N, int M, int P, int R[][2], int Q, int G[]){
n = N, m = M, p = P;
for(ll i = 0; i < m; i++){
Adj[R[i][0]].pb(R[i][1]);
Adj[R[i][1]].pb(R[i][0]);
//mp[{min(R[i][0], R[i][1]), m}
}
for(ll i = 0; i < n; i++){
// last trail is the best in all trails from i -> need to choose second if there is one
if(Adj[i].size() >= 2) nxt[i][1] = {Adj[i][1], (Adj[Adj[i][1]][0] == i)};
else nxt[i][1] = {Adj[i][0], (Adj[Adj[i][0]][0] == i)};
nxt[i][0] = {Adj[i][0], (Adj[Adj[i][0]][0] == i)};
}
for(ll i = 0; i < n; i++){
for(ll j = 0; j < 2; j++){
Adj2[nxt[i][j].fi][nxt[i][j].se].pb({i, j});
}
}
// finding the cycle for (p, 0)
ii itr = {p, 0};
ll len = 0;
while((!len || itr != make_pair(p, 0LL)) && len <= 2 * n){
len++;
itr = nxt[itr.fi][itr.se];
}
if(len > 2 * n) len = oo;
for(ll i = 0; i < n; i++) mn_dist[i][0] = mn_dist[i][1] = oo;
mn_dist[p][0] = 0;
queue<ii> bfs;
bfs.push({p, 0});
while(!bfs.empty()){
ii u = bfs.front();
bfs.pop();
for(auto it : Adj2[u.fi][u.se]){
if(mn_dist[it.fi][it.se] != oo) continue;
mn_dist[it.fi][it.se] = mn_dist[u.fi][u.se] + 1;
bfs.push(it);
}
}
for(ll i = 0; i < n; i++){
for(ll j = 0; j < 2; j++){
if(mn_dist[i][j] == oo) continue;
cyc[i][j].pb({mn_dist[i][j], len});
}
}
itr = {p, 1};
len = 0;
while((!len || itr != make_pair(p, 1LL)) && len <= 2 * n){
len++;
itr = nxt[itr.fi][itr.se];
}
if(len > 2 * n) len = oo;
for(ll i = 0; i < n; i++) mn_dist[i][0] = mn_dist[i][1] = oo;
mn_dist[p][1] = 0;
//queue<ii> bfs;
bfs.push({p, 1});
//cout << "OKAY\n";
while(!bfs.empty()){
ii u = bfs.front();
bfs.pop();
for(auto it : Adj2[u.fi][u.se]){
if(mn_dist[it.fi][it.se] != oo) continue;
mn_dist[it.fi][it.se] = mn_dist[u.fi][u.se] + 1;
bfs.push(it);
}
}
for(ll i = 0; i < n; i++){
for(ll j = 0; j < 2; j++){
if(mn_dist[i][j] == oo) continue;
cyc[i][j].pb({mn_dist[i][j], len});
//cout << i << " " << j << " " << mn_dist[i][j] << " " << len << "\n";
}
}
// exit(0);
for(ll i = 0; i < n; i++){
ii temp = {Adj[i][0], (Adj[Adj[i][0]][0] == i)};
savee[i] = {{-1, -1}, {-1, -1}};
for(auto it : cyc[temp.fi][temp.se]){
if(savee[i].fi.fi < 0) savee[i].fi = it;
else savee[i].se = it;
}
}
for(ll i = 0; i < Q; i++){
ll tol = 0;
G[i]--;
for(ll j = 0; j < n; j++){
//cout << temp.fi << " " << temp.se << "\n";
//cout << j << " " << Adj[j][0] << "\n";
//continue;
bool ck = 0;
if(savee[j].fi.fi >= 0){
ll diff = G[i] - savee[j].fi.fi;
ck = (diff >= 0 && !(diff % savee[j].fi.se));
if(!ck && savee[j].se.fi >= 0){
ll diff = G[i] - savee[j].se.fi;
ck = (diff >= 0 && !(diff % savee[j].se.se));
}
}
tol += ck;
}
//cout << i << " " << tol << "\n";
answer(tol);
//if(n >= 100000 && Q > 1) exit(0);
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 49
Accepted
Test #1:
score: 49
Accepted
time: 3ms
memory: 10236kb
input:
780 780 0 1 0 0 2 2 3 3 1 4 1 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50...
output:
Correct.
Test #2:
score: 0
Accepted
time: 3ms
memory: 10248kb
input:
950 950 0 1 0 0 2 2 3 3 1 4 1 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50...
output:
Correct.
Test #3:
score: 0
Accepted
time: 3ms
memory: 10488kb
input:
999 1099 0 1 0 0 2 2 3 3 1 4 1 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 5...
output:
Correct.
Test #4:
score: 0
Accepted
time: 0ms
memory: 10236kb
input:
45 44 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 1 100 1
output:
Correct.
Test #5:
score: 0
Accepted
time: 0ms
memory: 9916kb
input:
17 46 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 11 16 14 2 13 1 0 6 3 14 0 15 14 0 12 0 5 3 13 16 8 13 5 16 14 10 10 13 9 12 16 4 11 1 5 0 12 8 8 2 12 16 13 7 9 1 10 3 15 5 15 12 12 7 7 10 9 4 10 12 1 100 3
output:
Correct.
Test #6:
score: 0
Accepted
time: 3ms
memory: 10172kb
input:
1000 2000 7 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 0 0 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 ...
output:
Correct.
Test #7:
score: 0
Accepted
time: 2ms
memory: 9948kb
input:
70 170 10 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 ...
output:
Correct.
Test #8:
score: 0
Accepted
time: 3ms
memory: 10228kb
input:
1000 1000 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 0 8 0 9 0 10 2 11 6 12 11 13 9 14 2 15 3 16 14 17 15 18 5 19 2 20 3 21 1 22 2 23 4 24 9 25 2 26 17 27 15 28 5 29 20 30 12 31 24 32 28 33 26 34 25 35 32 36 8 37 16 38 2 39 18 40 3 41 38 42 15 43 39 44 18 45 23 46 37 47 10 48 24 49 47 50 40 51 4 52 19 53 50 54...
output:
Correct.
Test #9:
score: 0
Accepted
time: 4ms
memory: 10444kb
input:
1000 8000 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 0 13 4 14 0 15 10 16 5 17 6 18 14 19 2 20 6 21 10 22 18 23 18 24 0 25 10 26 22 27 11 28 5 29 16 30 14 31 2 32 0 33 0 34 9 35 24 36 34 37 34 38 37 39 15 40 22 41 1 42 32 43 10 44 18 45 35 46 21 47 45 48 32 49 16 50 30 51 44 52 31 53 ...
output:
Correct.
Subtask #2:
score: 20
Accepted
Dependency #1:
100%
Accepted
Test #10:
score: 20
Accepted
time: 0ms
memory: 9944kb
input:
100 100 13 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 0 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 10 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 27 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 ...
output:
Correct.
Test #11:
score: 0
Accepted
time: 49ms
memory: 51956kb
input:
135000 142500 2 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 65899 68039 16 0 17 18 18 19 19 20 20 21 21 22 125073 94485 22 23 23 24 24 25 25 26 26 27 27 28 77287 19161 28 29 29 30 30 31 31 32 32 33 33 34 34 17 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 ...
output:
Correct.
Test #12:
score: 0
Accepted
time: 63ms
memory: 59964kb
input:
136500 148500 5 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 16375 41566 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 0 23 3 24 10 25 22 26 14 27 25 28 23 29 20 30 9 31 2 32 0 33 23 34 32 35 7 36 6 37 9 38 7 39 31 87416 33922 40 5 41 29 42 2 43 15 44 21 45 18 46 42 47 36 48...
output:
Correct.
Test #13:
score: 0
Accepted
time: 53ms
memory: 44580kb
input:
91500 136500 20 89996 82811 0 1 30077 17428 46967 14606 1 2 2 3 3 4 4 5 20321 91440 5 6 6 7 25893 61981 7 8 84360 43614 8 9 68077 71226 9 10 23469 60159 10 11 11 12 50911 81003 12 13 4323 50214 90721 74352 13 14 75252 66390 14 15 3776 36420 15 16 16 17 58288 11702 17 18 18 19 49600 3263 19 20 20 21 ...
output:
Correct.
Test #14:
score: 0
Accepted
time: 54ms
memory: 38052kb
input:
76500 136498 0 56932 48973 1 0 56331 57161 2 0 17168 73563 3736 61655 16253 38330 3 1 4 3 5 1 4642 11834 26074 3018 12112 75650 58168 23812 1684 37453 6 0 14001 44650 54304 2234 53135 45296 56151 9690 7 6 8 7 9 2 10 5 34373 20594 11 5 12 2 64635 19590 63284 21071 13 2 14 10 15 1 16 15 17 7 68264 392...
output:
Correct.
Test #15:
score: 0
Accepted
time: 59ms
memory: 54840kb
input:
150000 150000 200 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 5...
output:
Correct.
Test #16:
score: 0
Accepted
time: 11ms
memory: 16488kb
input:
22500 22500 200 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 ...
output:
Correct.
Test #17:
score: 0
Accepted
time: 16ms
memory: 23924kb
input:
37500 52500 500 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 ...
output:
Correct.
Test #18:
score: 0
Accepted
time: 27ms
memory: 42756kb
input:
85183 85182 13 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 5...
output:
Correct.
Test #19:
score: 0
Accepted
time: 52ms
memory: 52528kb
input:
135000 142500 2 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 0 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 17 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 5...
output:
Correct.
Test #20:
score: 0
Accepted
time: 62ms
memory: 58264kb
input:
136500 148500 5 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 0 23 0 24 17 25 13 26 17 27 16 28 16 29 9 30 7 31 5 32 7 33 11 34 26 35 19 36 35 37 6 38 36 39 31 40 25 41 10 42 34 43 4 44 34 45 33 46 0 47 31 48 29 49 8 50 6 51 20 52...
output:
Correct.
Test #21:
score: 0
Accepted
time: 48ms
memory: 44700kb
input:
91500 136500 20 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 ...
output:
Correct.
Test #22:
score: 0
Accepted
time: 42ms
memory: 41156kb
input:
76500 136499 0 1 0 2 1 3 2 4 1 5 0 6 3 7 6 8 2 9 6 10 2 11 1 12 10 13 12 14 4 15 8 16 9 17 13 18 10 19 8 20 16 21 7 22 12 23 21 24 2 25 14 26 25 27 11 28 8 29 11 30 14 31 8 32 23 33 25 34 13 35 30 36 12 37 34 38 31 39 19 40 31 41 6 42 33 43 2 44 23 45 36 46 24 47 20 48 36 49 1 50 18 51 33 52 24 53 4...
output:
Correct.
Test #23:
score: 0
Accepted
time: 21ms
memory: 22300kb
input:
37500 52500 500 13868 25474 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 17587 629 8 9 9 10 19816 31812 11107 8848 28455 3355 10 11 11988 2929 11 12 12 13 13 14 14 15 36479 21472 2068 20945 15 16 16 17 17 18 16477 36228 18 19 19 20 24507 32786 24966 24172 20 21 21 22 22 23 23 24 24 25 24933 29140 25 26 7114 1900...
output:
Correct.
Subtask #3:
score: 31
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #24:
score: 31
Accepted
time: 0ms
memory: 10028kb
input:
100 100 13 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 0 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 10 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 27 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 ...
output:
Correct.
Test #25:
score: 0
Accepted
time: 638ms
memory: 52672kb
input:
135000 142500 2 0 1 78631 69685 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 0 17 18 116459 101820 18 19 19 20 20 21 32482 16785 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 17 89461 85481 35 36 36 37 37 38 3105 74349 38 39 39 40 40 ...
output:
Correct.
Test #26:
score: 0
Accepted
time: 980ms
memory: 62012kb
input:
136500 148500 5 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 0 23 8 24 6 25 18 26 13 94298 122572 27 1 28 10 29 14 30 26 42247 134674 115194 12005 31 6 32 2 33 13 34 1 35 15 36 29 37 4 38 17 39 20 40 28 41 10 113790 99619 42 4 43...
output:
Correct.
Test #27:
score: 0
Accepted
time: 584ms
memory: 43904kb
input:
91500 136500 20 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 89583 12705 15386 18856 9 10 10 11 11 12 12 13 13 14 14 15 15 16 75363 22385 16 17 17 18 18 19 67093 28419 11991 85749 19 20 15907 18111 71293 48519 20 21 21 22 22 23 20152 82707 46242 36173 23 24 18258 86900 24 25 478 62127 25 26 26 27 11670 65208...
output:
Correct.
Test #28:
score: 0
Accepted
time: 798ms
memory: 41452kb
input:
76500 136499 0 1 0 2 0 11009 35861 3 0 4 1 5 4 6794 7931 64365 46891 6 4 7 5 65606 48720 8 5 3787 42684 39208 67987 25041 12070 9 6 27046 61933 10 0 70108 45018 29799 16017 42422 35831 11 10 12 9 13 2 14 10 15 7 11870 462 16 9 61190 47521 17 13 5646 6250 18 6 1435 74586 19 4 41896 74861 11268 466 20...
output:
Correct.
Test #29:
score: 0
Accepted
time: 481ms
memory: 54844kb
input:
150000 150000 200 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 5...
output:
Correct.
Test #30:
score: 0
Accepted
time: 37ms
memory: 16436kb
input:
22500 22500 200 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 ...
output:
Correct.
Test #31:
score: 0
Accepted
time: 77ms
memory: 22320kb
input:
37500 52500 500 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 ...
output:
Correct.
Test #32:
score: 0
Accepted
time: 1009ms
memory: 44724kb
input:
85183 85182 13 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 5...
output:
Correct.
Test #33:
score: 0
Accepted
time: 643ms
memory: 52780kb
input:
135000 142500 2 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 0 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 17 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 5...
output:
Correct.
Test #34:
score: 0
Accepted
time: 979ms
memory: 60084kb
input:
136500 148500 5 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 0 23 16 24 21 25 9 26 6 27 23 28 0 29 2 30 26 31 8 32 12 33 20 34 6 35 2 36 25 37 22 38 30 39 23 40 37 41 19 42 25 43 16 44 11 45 39 46 18 47 29 48 42 49 8 50 29 51 1 5...
output:
Correct.
Test #35:
score: 0
Accepted
time: 581ms
memory: 44812kb
input:
91500 136500 20 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 ...
output:
Correct.
Test #36:
score: 0
Accepted
time: 572ms
memory: 39420kb
input:
76500 136499 0 1 0 2 1 3 2 4 3 5 3 6 3 7 3 8 6 9 8 10 2 11 1 12 4 13 9 14 6 15 8 16 5 17 16 18 12 19 4 20 13 21 11 22 11 23 19 24 18 25 4 26 19 27 17 28 5 29 17 30 23 31 16 32 28 33 1 34 0 35 28 36 12 37 8 38 20 39 14 40 35 41 36 42 2 43 27 44 42 45 19 46 35 47 22 48 46 49 10 50 42 51 48 52 43 53 4 ...
output:
Correct.
Test #37:
score: 0
Accepted
time: 72ms
memory: 22592kb
input:
37500 52499 500 0 1 1 2 20222 31256 2 3 3670 20196 3 4 4 5 23873 19374 5 6 6 7 7 8 8 9 9 10 10 11 11 12 26811 32595 12 13 13 14 16759 18923 20766 14587 14 15 15 16 16 17 17 18 20466 17598 18 19 24030 23281 19 20 20 21 21 22 22 23 23 24 24 25 4017 33535 4823 9970 25 26 26 27 27 28 24151 6384 28 29 29...
output:
Correct.