QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#189262#2559. Endless RoadInsert_Username_HereRE 901ms76860kbC++204.3kb2023-09-27 06:25:022023-09-27 06:25:03

Judging History

你现在查看的是最新测评结果

  • [2023-09-27 06:25:03]
  • 评测
  • 测评结果:RE
  • 用时:901ms
  • 内存:76860kb
  • [2023-09-27 06:25:02]
  • 提交

answer

#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
// copium

struct bit {
  ll bit[1 << 18];
  void update(ll i, ll val) {
    i++;
    while(i <= (1 << 18)) {
      bit[i] += val;
      i += i & (-i);
    }
  }
  ll query(ll i) {
    i++;
    ll sum = 0;
    while(i > 0) {
      sum += bit[i];
      i -= i & (-i);
    }
    return sum;
  }
  ll query(ll l, ll r) {
    if(l == 0) return query(r);
    return query(r) - query(l - 1);
  }
} sum;
const ll N = 1 << 18;
pair<pair<ll, ll>, ll> arr[250001];
struct seg {
  pair<ll, ll> seg[N << 1];
  ll lazy[N << 1];
  void kms(ll i, ll val) {
    seg[i].f += val, lazy[i] += val;
  }
  void push(ll i) {
    if(lazy[i]) {
      kms(2 * i, lazy[i]), kms(2 * i + 1, lazy[i]);
      lazy[i] = 0;
    }
  }
  void init(ll i = 1, ll l1 = 0, ll r1 = N - 1) {
    lazy[i] = 0;
    if(l1 == r1) {
      seg[i] = mp(2e9, 0);
      return;
    }
    ll mid = (l1 + r1) / 2;
    init(2 * i, l1, mid);
    init(2 * i + 1, mid + 1, r1);
    pull(i);
  }
  void pull(ll i) {
    if(seg[2 * i].f == seg[2 * i + 1].f) {
      if(arr[seg[2 * i].s].s < arr[seg[2 * i + 1].s].s) seg[i] = seg[2 * i];
      else seg[i] = seg[2 * i + 1];
    } else seg[i] = min(seg[2 * i], seg[2 * i + 1]);
  }
  void upd(ll i, pair<ll, ll> val, ll i1 = 1, ll l1 = 0, ll r1 = N - 1) {
    if(l1 > i || r1 < i) return;
    if(i == l1 && i == r1) {
      seg[i1] = val;
      return;
    }
    ll mid = (l1 + r1) / 2;
    push(i1);
    upd(i, val, 2 * i1, l1, mid);
    upd(i, val, 2 * i1 + 1, mid + 1, r1);
    pull(i1);
  }
  void inc(ll l, ll r, ll val, ll i = 1, ll l1 = 0, ll r1 = N - 1) {
    if(l1 > r || r1 < l) return;
    if(l <= l1 && r1 <= r) {
      kms(i, val);
      return;
    }
    push(i);
    ll mid = (l1 + r1) / 2;
    inc(l, r, val, 2 * i, l1, mid);
    inc(l, r, val, 2 * i + 1, mid + 1, r1);
    pull(i);
  }
  pair<ll, ll> query(ll l, ll r, ll i = 1, ll l1 = 0, ll r1 = N - 1) {
    if(l1 > r || r1 < l) return mp(2e9, 2e9);
    if(l <= l1 && r1 <= r) return seg[i];
    push(i);
    ll mid = (l1 + r1) / 2;
    return min(query(l, r, 2 * i, l1, mid), query(l, r, 2 * i + 1, mid + 1, r1));
  }
} seg1, seg2;
ll n;
ll wxzs[500001];
set<pair<ll, ll>> s;
set<ll> bk;
void add(ll i) {
  seg1.upd(i, mp(sum.query(arr[i].f.f, arr[i].f.s - 1), i));
  s.insert(mp(arr[i].f.s, i));
}
void del(ll l, ll r) {
  auto it = bk.lower_bound(l);
  while(it != bk.end() && *it < r) {
    auto it2 = s.lower_bound(mp(*it + 1, 0ll));
    if(it2 != s.end()) {
      ll idfk = lower_bound(arr, arr + n, mp(mp(*it + 1, 0ll), 0ll)) - arr - 1;
      if(it2->s <= idfk) seg1.inc(it2->s, idfk, wxzs[*it] - wxzs[*it + 1]);
    }
    sum.update(*it, wxzs[*it] - wxzs[*it + 1]);
    it = bk.erase(it);
  }
}

signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  pair<ll, ll> idk[2 * n];
  for(ll i = 0; i < 2 * n; i++) {
    cin >> idk[i].f;
    idk[i].s = i;
  }
  sort(idk, idk + 2 * n);
  ll cur = 0;
  ll idfk[2 * n];
  wxzs[0] = idk[0].f;
  for(ll i = 0; i < 2 * n; i++) {
    if(i > 0 && idk[i].f != idk[i - 1].f) {
      sum.update(cur, idk[i].f - idk[i - 1].f);
      bk.insert(cur);
      cur++;
      wxzs[cur] = idk[i].f;
    }
    idfk[i] = cur;
  }
  for(ll i = 0; i < 2 * n; i++) {
    if(idk[i].s & 1) arr[idk[i].s / 2].f.s = idfk[i];
    else arr[idk[i].s / 2].f.f = idfk[i];
    arr[i / 2].s = i / 2 + 1;
  }
  sort(arr, arr + n);
  seg1.init(), seg2.init();
  cur = 2e9;
  for(ll i = n - 1; i >= 0; i--) {
    if(arr[i].f.s < cur) {
      cur = arr[i].f.s;
      add(i);
    }
    else seg2.upd(i, mp(arr[i].f.s, i));
  }
  for(ll i = 0; i < n; i++) {
    cur = seg1.seg[1].s;
    cout << arr[cur].s << " ";
    del(arr[cur].f.f, arr[cur].f.s);
    seg1.upd(cur, mp(2e9, 0));
    auto it = s.erase(s.find(mp(arr[cur].f.s, cur)));
    cur = -1;
    if(it != s.begin()) cur = prev(it)->s;
    ll whar = 2e9;
    if(it != s.end()) whar = it->f;
    while(cur < n) {
      auto thing = seg2.query(max(0ll, cur), n - 1);
      if(thing.f >= whar) break;
      cur = thing.s;
      add(cur);
      seg2.upd(cur, mp(2e9, 0));
    }
  }
  cout << "\n";
}

詳細信息

Test #1:

score: 100
Accepted
time: 4ms
memory: 28104kb

input:

6
1 2
2 3
3 4
4 5
1 3
3 5

output:

1 2 5 3 4 6 

result:

ok 6 tokens

Test #2:

score: 0
Accepted
time: 4ms
memory: 28216kb

input:

4
3 7
10 14
1 6
6 11

output:

1 3 2 4 

result:

ok 4 tokens

Test #3:

score: 0
Accepted
time: 0ms
memory: 28144kb

input:

100
50 51
49 51
49 52
48 52
48 53
47 53
47 54
46 54
46 55
45 55
45 56
44 56
44 57
43 57
43 58
42 58
42 59
41 59
41 60
40 60
40 61
39 61
39 62
38 62
38 63
37 63
37 64
36 64
36 65
35 65
35 66
34 66
34 67
33 67
33 68
32 68
32 69
31 69
31 70
30 70
30 71
29 71
29 72
28 72
28 73
27 73
27 74
26 74
26 75
25...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 

result:

ok 100 tokens

Test #4:

score: 0
Accepted
time: 0ms
memory: 28124kb

input:

100
41 42
99 100
47 48
50 51
56 57
61 62
27 28
85 86
44 45
3 4
26 27
20 21
92 93
33 34
86 87
69 70
84 85
62 63
81 82
2 3
13 14
32 33
82 83
70 71
46 47
45 46
19 20
83 84
57 59
63 65
59 61
82 84
45 47
48 50
70 72
42 44
84 86
26 28
61 63
2 4
17 19
65 67
54 56
67 69
96 99
42 45
47 50
34 37
14 17
51 54
7...

output:

1 2 3 4 5 6 7 8 9 10 11 38 12 13 14 15 16 17 37 18 39 19 20 40 21 22 23 24 25 26 33 27 28 32 35 29 30 31 57 73 34 47 71 36 46 41 53 42 58 43 54 44 52 77 45 63 48 62 49 64 80 50 60 79 91 51 66 89 55 65 83 56 59 67 86 61 72 82 90 96 68 75 81 93 69 74 84 92 70 87 88 94 97 99 76 78 85 95 98 100 

result:

ok 100 tokens

Test #5:

score: 0
Accepted
time: 4ms
memory: 28076kb

input:

100
26 27
68 69
33 34
96 97
42 43
6 7
60 61
22 23
9 10
19 20
38 39
7 8
73 74
64 65
53 54
84 85
15 16
79 80
62 63
11 12
32 33
80 81
95 96
54 55
83 84
89 90
55 56
74 75
97 98
81 82
23 24
57 58
14 15
34 35
59 60
40 41
46 47
18 19
21 22
56 57
35 36
69 70
82 83
94 95
63 64
86 87
31 32
76 77
39 40
47 48
4...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 

result:

ok 100 tokens

Test #6:

score: 0
Accepted
time: 0ms
memory: 28132kb

input:

100
66 67
42 43
32 33
28 29
96 97
19 20
41 42
38 39
73 74
50 51
31 32
40 41
3 4
72 73
29 30
45 46
14 15
11 12
68 69
21 22
25 26
51 52
75 76
76 77
8 9
99 100
53 54
27 28
61 62
26 27
74 75
84 85
64 65
79 80
71 72
85 86
33 34
0 1
90 91
24 25
4 6
51 53
64 66
34 36
94 96
66 68
97 99
31 33
80 82
19 21
88 ...

output:

1 2 3 4 5 6 7 8 9 10 11 48 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 76 81 31 66 32 33 34 35 36 59 37 38 39 40 42 43 46 50 55 57 64 41 44 62 74 78 87 90 45 71 47 49 51 69 52 53 54 82 56 58 72 60 68 73 61 63 91 65 75 67 70 84 94 95 77 79 88 96 98 80 89 83 85 86 92 93 97 99 100 

result:

ok 100 tokens

Test #7:

score: 0
Accepted
time: 3ms
memory: 28116kb

input:

100
69 70
15 16
55 56
91 92
34 35
92 93
20 21
10 11
22 23
4 5
82 83
86 87
77 78
49 50
65 66
29 30
83 84
1 2
13 14
30 31
32 33
0 1
19 20
48 49
31 33
87 89
8 10
92 94
54 56
21 23
57 59
51 53
1 3
83 85
77 79
63 65
31 34
46 49
7 10
80 83
24 27
91 94
74 77
66 69
51 54
77 80
20 23
56 59
34 37
43 46
87 90
...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 28 42 29 30 47 33 34 35 37 46 55 26 51 59 61 68 27 39 56 63 69 71 31 48 32 45 36 38 40 65 78 49 54 62 74 77 73 76 41 64 79 43 44 58 66 50 52 67 60 72 53 57 70 75 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 

result:

ok 100 tokens

Test #8:

score: 0
Accepted
time: 4ms
memory: 28120kb

input:

100
27 28
56 57
79 80
34 35
98 99
31 32
55 56
67 68
25 26
47 48
58 59
46 47
49 50
42 43
80 81
43 44
83 84
90 91
48 49
82 83
59 60
81 82
92 93
91 92
69 70
30 31
77 78
66 67
50 51
54 55
63 64
57 58
26 27
28 29
11 12
68 70
26 28
35 37
44 46
74 76
87 89
93 95
10 12
83 85
32 34
97 99
37 39
28 30
64 66
76...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 37 34 35 36 43 44 46 48 65 50 53 58 60 62 64 66 67 68 70 71 73 77 80 84 85 87 88 89 91 38 54 39 40 61 79 41 74 78 82 42 76 83 93 45 63 75 47 49 59 69 51 55 72 81 90 86 95 92 94 96 97 98 99 52 56 57 100 

result:

ok 100 tokens

Test #9:

score: 0
Accepted
time: 23ms
memory: 29588kb

input:

10000
504758807 504763364
504735683 504763364
504735683 504807338
504507299 504807338
504507299 504809080
504428573 504809080
504428573 504842988
504407969 504842988
504407969 504925719
504242659 504925719
504242659 504982796
504192499 504982796
504192499 504988790
504164090 504988790
504164090 5049...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 10000 tokens

Test #10:

score: 0
Accepted
time: 18ms
memory: 29432kb

input:

10000
970160455 970160479
932488256 932488310
383539934 383539995
375340196 375340274
865733105 865733219
735585223 735585367
687954828 687955008
870182994 870183203
320739206 320739425
905982784 905983157
628124616 628125095
558426226 558426706
562201395 562201974
439234363 439234971
709751667 7097...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 10000 tokens

Test #11:

score: 0
Accepted
time: 23ms
memory: 30208kb

input:

10000
410601820 410601821
294090792 294090799
441422212 441422222
670420210 670420222
59461862 59461893
90469319 90469353
179055474 179055527
252981238 252981294
283998869 283998965
490236705 490236809
841458496 841458612
851847119 851847283
849148457 849148637
294090609 294090792
483689813 48369000...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 10000 tokens

Test #12:

score: 0
Accepted
time: 26ms
memory: 29656kb

input:

10000
495013411 495013425
999006846 999006868
296771081 296771115
150818948 150819019
642881267 642881350
560800096 560800192
138097500 138097596
21121422 21121529
109953510 109953653
428516381 428516550
958914894 958915117
714510610 714510838
412832098 412832339
343551761 343552012
778598526 778598...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 10000 tokens

Test #13:

score: 0
Accepted
time: 22ms
memory: 29548kb

input:

10000
350318312 350318340
149202565 149202603
179261197 179261247
779925340 779925446
194445305 194445467
848400332 848400535
522118665 522118875
822005975 822006190
825371374 825371610
136200561 136200830
788364490 788364769
859844322 859844733
643922682 643923146
901332582 901333056
388316426 3883...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 49 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 10000 tokens

Test #14:

score: 0
Accepted
time: 20ms
memory: 29696kb

input:

10000
512474957 512474969
736102015 736102067
678460955 678461007
586742723 586742795
865924891 865924995
896796735 896796877
328184375 328184586
487430461 487430675
657033983 657034205
797801001 797801273
677420006 677420297
285432467 285432761
408167954 408168287
334723223 334723567
832094664 8320...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 10000 tokens

Test #15:

score: 0
Accepted
time: 382ms
memory: 61304kb

input:

250000
500096771 500097498
500096275 500097498
500096275 500100939
500093322 500100939
500093322 500112779
500090810 500112779
500090810 500115618
500088604 500115618
500088604 500126767
500084824 500126767
500084824 500133232
500083865 500133232
500083865 500139175
500077522 500139175
500077522 500...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #16:

score: 0
Accepted
time: 685ms
memory: 61280kb

input:

250000
85486113 85486114
764344182 764344183
80926569 80926570
424364875 424364876
364430765 364430766
817052534 817052535
384672374 384672375
543281764 543281765
737198375 737198376
125069155 125069156
657704584 657704585
446558 446559
156161119 156161121
732837937 732837939
217487474 217487476
190...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #17:

score: 0
Accepted
time: 901ms
memory: 76860kb

input:

250000
634183423 634183424
970923132 970923133
804072367 804072368
576349809 576349810
994154427 994154428
685654067 685654068
134115901 134115902
358374271 358374272
309901650 309901651
553753853 553753854
320313586 320313587
584364010 584364011
748086184 748086185
844313419 844313420
415503381 415...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #18:

score: 0
Accepted
time: 771ms
memory: 66628kb

input:

250000
715346678 715346679
714637137 714637138
633551466 633551467
571236648 571236649
498709620 498709621
873709613 873709614
576384535 576384536
713177321 713177322
832495136 832495137
473929476 473929477
611535779 611535780
51152059 51152060
629294042 629294043
683330515 683330516
536475001 53647...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 152 93 94 95 96 97 98 99 100 101 ...

result:

ok 250000 tokens

Test #19:

score: 0
Accepted
time: 712ms
memory: 64164kb

input:

250000
204357492 204357493
313754225 313754226
891470468 891470469
164687535 164687536
274352813 274352814
104592850 104592851
93157865 93157866
947093093 947093094
786274307 786274308
276719515 276719516
983251600 983251601
248092788 248092789
580394950 580394951
240692867 240692868
816006370 81600...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #20:

score: 0
Accepted
time: 504ms
memory: 61392kb

input:

250000
908254268 908254269
729940366 729940367
710542793 710542794
763639638 763639639
940321019 940321020
690381691 690381692
985556152 985556153
974524252 974524253
667359981 667359982
804102328 804102329
937363555 937363556
903556494 903556495
996482064 996482065
829397907 829397908
853180411 853...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #21:

score: 0
Accepted
time: 608ms
memory: 69100kb

input:

250000
911439698 911439699
601116606 601116607
799754310 799754311
731458404 731458405
653237434 653237435
809687265 809687266
745375860 745375861
573271297 573271298
943835593 943835594
924002421 924002422
884740893 884740894
920210232 920210233
921905222 921905223
964818240 964818241
759486093 759...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #22:

score: 0
Accepted
time: 556ms
memory: 64164kb

input:

250000
810906247 810906248
783312898 783312899
929278352 929278353
606238216 606238217
640251409 640251410
798897100 798897101
944346653 944346654
893792716 893792717
588275748 588275749
755564491 755564492
664378047 664378048
676934947 676934948
869176315 869176316
896196002 896196004
843180309 843...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #23:

score: 0
Accepted
time: 553ms
memory: 62632kb

input:

250000
966452187 966452188
911184832 911184833
736688733 736688734
637571769 637571770
883830510 883830511
652142318 652142319
654878010 654878011
920603163 920603164
912168767 912168768
887031080 887031081
731071016 731071017
985129224 985129226
625447553 625447555
938075724 938075726
640361668 640...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #24:

score: 0
Accepted
time: 783ms
memory: 69044kb

input:

250000
575892627 575892628
923773683 923773684
623074090 623074091
746352644 746352645
851375669 851375670
412767397 412767398
215851075 215851076
450454718 450454719
958858707 958858708
244531181 244531182
676969785 676969786
994631529 994631530
545838025 545838026
685667774 685667775
590424846 590...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #25:

score: 0
Accepted
time: 709ms
memory: 64112kb

input:

250000
421717318 421717319
272387732 272387733
957076320 957076321
753478255 753478256
400247018 400247019
438723233 438723234
126245890 126245891
817192839 817192840
899802321 899802322
641451967 641451968
77468226 77468227
899920216 899920217
341808761 341808762
495672063 495672064
451184428 45118...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #26:

score: 0
Accepted
time: 738ms
memory: 62740kb

input:

250000
15667723 15667724
685591547 685591548
160592460 160592461
348956848 348956849
495816950 495816951
140563929 140563930
690010543 690010544
881005221 881005222
879958490 879958491
312729441 312729442
30368232 30368233
949096729 949096730
435746802 435746803
610674420 610674421
181520623 1815206...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 104 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok 250000 tokens

Test #27:

score: 0
Accepted
time: 819ms
memory: 71784kb

input:

250000
623592459 623592460
529342736 529342737
318696506 318696507
223988396 223988397
106543202 106543203
435530265 435530266
113563918 113563919
216000543 216000544
180787594 180787595
830824189 830824190
184038830 184038831
464818269 464818270
321644783 321644784
879731728 879731729
321698071 321...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #28:

score: 0
Accepted
time: 819ms
memory: 70544kb

input:

250000
507202231 507202232
757693390 757693391
792197010 792197011
481005914 481005915
281579197 281579198
545997917 545997918
224943609 224943610
183451471 183451472
923239198 923239199
157569794 157569795
205581391 205581392
81071976 81071977
63496319 63496320
26726460 26726461
308333064 308333065...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #29:

score: 0
Accepted
time: 742ms
memory: 65436kb

input:

250000
152742027 152742028
988631943 988631944
693718919 693718920
835236399 835236400
846195231 846195232
971156078 971156079
40643204 40643205
453493799 453493800
808895489 808895490
195754309 195754310
649881100 649881101
917078287 917078288
30209729 30209730
367191992 367191993
906447575 9064475...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #30:

score: 0
Accepted
time: 687ms
memory: 66000kb

input:

250000
820083714 820083715
455532818 455532819
672408966 672408967
799624092 799624093
362239178 362239179
263818004 263818005
707415205 707415206
498890828 498890829
549055725 549055726
259244394 259244395
935654312 935654313
323901468 323901469
344512297 344512298
624028139 624028140
420977523 420...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #31:

score: 0
Accepted
time: 655ms
memory: 66128kb

input:

250000
785310156 785310157
616756958 616756959
769557932 769557933
884589147 884589148
507437389 507437390
342202915 342202916
510430398 510430399
557387513 557387514
509675567 509675568
564141821 564141822
657181411 657181412
538793195 538793196
866363886 866363887
506491541 506491542
645459978 645...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #32:

score: 0
Accepted
time: 503ms
memory: 62452kb

input:

250000
867233463 867233464
727524519 727524520
800701962 800701963
904854946 904854947
905899680 905899681
910809299 910809300
775930190 775930191
681957425 681957426
949045891 949045892
927762699 927762700
813850695 813850697
777184307 777184309
905512374 905512376
780643953 780643955
900107965 900...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #33:

score: 0
Accepted
time: 813ms
memory: 71980kb

input:

250000
41064860 41064861
365192452 365192453
332474706 332474707
244395718 244395719
47043554 47043555
553569909 553569910
340141934 340141935
426479029 426479030
609889800 609889801
353067496 353067497
379771073 379771074
474746166 474746167
719103945 719103946
308434035 308434036
71165138 71165139...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #34:

score: 0
Accepted
time: 696ms
memory: 62472kb

input:

250000
101271937 101271938
703413861 703413862
432354585 432354586
315127791 315127792
253465613 253465614
937421245 937421246
46740922 46740923
567520123 567520124
344254470 344254471
521294086 521294087
598322263 598322264
9012905 9012906
239501074 239501075
398239223 398239224
515021310 515021311...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #35:

score: 0
Accepted
time: 517ms
memory: 65004kb

input:

250000
722192593 722192594
653958789 653958790
795937260 795937261
838603569 838603570
818282528 818282529
885431784 885431785
672684490 672684491
886387322 886387323
743251379 743251380
978657955 978657956
747262733 747262734
804343895 804343896
746877892 746877893
880531988 880531989
690844398 690...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #36:

score: 0
Accepted
time: 537ms
memory: 64996kb

input:

250000
840742879 840742880
796088976 796088977
974319783 974319784
807713495 807713496
649129201 649129202
763694081 763694082
794932277 794932278
664624444 664624445
806919859 806919860
798145803 798145804
905829138 905829139
875681260 875681261
643495064 643495065
923523659 923523660
901839671 901...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #37:

score: 0
Accepted
time: 514ms
memory: 64996kb

input:

250000
714244818 714244819
758924999 758925000
886453439 886453440
638331408 638331409
693854359 693854360
799892624 799892625
776491021 776491022
697581798 697581799
652461474 652461475
767212008 767212009
870797975 870797976
808413233 808413234
753533516 753533517
883741186 883741187
636166215 636...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #38:

score: 0
Accepted
time: 510ms
memory: 64404kb

input:

250000
724618109 724618110
939438135 939438136
766300581 766300582
821313665 821313666
955458914 955458915
679045549 679045550
747380342 747380343
884907781 884907782
949559834 949559835
670795625 670795626
911842147 911842148
703016029 703016030
734700048 734700049
860663783 860663784
979292013 979...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #39:

score: 0
Accepted
time: 505ms
memory: 64428kb

input:

250000
829755973 829755974
921179253 921179254
724815495 724815496
960686361 960686362
671408618 671408619
976200886 976200887
974790302 974790303
773269115 773269116
813566891 813566892
794798749 794798750
705753166 705753167
693819197 693819198
698645465 698645466
927641109 927641110
862645626 862...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 159 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok 250000 tokens

Test #40:

score: 0
Accepted
time: 519ms
memory: 64564kb

input:

250000
915528805 915528806
942320820 942320821
921435024 921435025
698284841 698284842
750289122 750289123
681090084 681090085
765819587 765819588
728031435 728031436
748260708 748260709
676736654 676736655
974156806 974156807
845128869 845128870
922220397 922220398
711469089 711469090
741589498 741...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #41:

score: 0
Accepted
time: 517ms
memory: 65100kb

input:

250000
711045124 711045125
834068921 834068922
826787590 826787591
816460093 816460094
645767989 645767990
709857765 709857766
741358303 741358304
748677296 748677297
743269740 743269741
858077145 858077146
777118955 777118956
805541579 805541580
868137595 868137596
653491669 653491670
913963339 913...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #42:

score: 0
Accepted
time: 528ms
memory: 64980kb

input:

250000
745739052 745739053
933151515 933151516
791414723 791414724
845728531 845728532
786808592 786808593
800642037 800642038
700178474 700178475
863110603 863110604
722319993 722319994
797545919 797545920
801425253 801425254
711801969 711801970
753984158 753984159
916793343 916793344
746907731 746...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 250000 tokens

Test #43:

score: 0
Accepted
time: 0ms
memory: 28232kb

input:

100
98 99
79 80
83 85
67 69
29 32
86 89
81 85
57 61
64 69
91 97
81 87
36 42
30 36
42 48
38 44
57 64
42 49
8 16
68 77
3 12
61 70
16 27
57 68
20 32
15 28
78 91
81 95
42 57
57 72
74 89
23 38
8 23
45 61
34 50
22 38
41 58
9 26
77 94
34 51
75 93
57 78
50 72
28 50
54 76
2 25
53 76
59 83
57 81
19 44
60 85
1...

output:

1 2 3 4 7 11 6 5 9 8 16 23 21 29 13 26 27 38 10 40 30 19 41 47 48 50 52 54 61 64 66 68 67 44 46 42 58 59 33 53 14 17 28 36 70 84 15 62 69 80 12 34 39 72 74 78 85 87 88 43 77 81 91 79 31 94 35 71 24 76 49 56 60 51 89 95 22 25 63 65 96 75 83 73 37 98 18 32 57 86 92 55 99 90 20 45 82 93 97 100 

result:

ok 100 tokens

Test #44:

score: 0
Accepted
time: 15ms
memory: 29004kb

input:

10000
627 628
344 345
36 37
633 634
280 281
914 915
440 441
666 667
206 207
889 890
236 237
127 128
753 754
460 461
867 868
563 564
679 680
37 38
143 144
144 145
936 937
504 505
731 732
508 509
904 905
44 45
705 706
859 861
157 159
687 689
358 360
138 140
594 596
42 44
197 199
380 382
433 435
297 29...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 63 30 31 32 62 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 53 65 69 77 80 81 82 48 49 94 50 106 51 113 134 52 54 132 55 56 57 58 59 60 61 76 64 66 67 68 70 78 83 126 91 98 122 123 173 136 107 119 127 139 157 194 213 241 3...

result:

ok 10000 tokens

Test #45:

score: 0
Accepted
time: 18ms
memory: 30048kb

input:

10000
502999023 503206104
188312680 188532331
80206162 80617293
171734421 172370698
974706558 975357746
673844375 674524201
490242443 490940422
13424417 14171988
597854899 598724318
371302373 372220130
496038992 496980898
265869490 266828573
287487993 288448417
680578821 681566435
846259525 84731789...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 31 16 17 18 19 20 21 22 23 24 25 26 27 62 28 49 29 30 37 32 33 34 35 36 38 39 46 40 52 41 42 43 44 67 45 47 48 50 51 53 95 68 54 55 56 57 96 161 58 69 59 111 164 110 197 247 160 168 317 198 285 472 327 60 87 65 61 135 63 64 86 167 209 236 185 158 294 303 357 590 2...

result:

ok 10000 tokens

Test #46:

score: 0
Accepted
time: 370ms
memory: 46464kb

input:

250000
1110 1111
7092 7093
3994 3995
3050 3051
1026 1027
5311 5312
8461 8462
2704 2705
7036 7037
5414 5415
5405 5406
3731 3732
2307 2308
930 931
2978 2979
8622 8623
2908 2909
1579 1580
7894 7895
9790 9791
1148 1149
9060 9061
2055 2056
9948 9949
7034 7035
1440 1441
9311 9312
4908 4909
9331 9332
1317 ...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 141 184 ...

result:

ok 250000 tokens

Test #47:

score: -100
Runtime Error

input:

250000
606969544 606971065
168165353 168168121
186312146 186319520
613915970 613927381
555902985 555918493
544879212 544894773
134179845 134200483
383535289 383556039
718364140 718385918
189652836 189678695
744168196 744194511
909312172 909338776
620452120 620482319
203596526 203629405
998788257 998...

output:


result: