QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#114796#119. Worst Reporter 3minhcool12 11ms5736kbC++171.5kb2023-06-23 16:38:002023-06-23 16:38:09

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-23 16:38:09]
  • 评测
  • 测评结果:12
  • 用时:11ms
  • 内存:5736kb
  • [2023-06-23 16:38:00]
  • 提交

answer

#define local
#ifndef local
#include ""
#endif
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

const int N = 3e5 + 5;

const int oo = 1e18 + 7, mod = 1e9 + 7;

mt19937 rng(1);

int rnd(int l, int r){
	int temp = rng() % (r - l + 1);
	return abs(temp) + l;
}

int n, q, d[N];

vector<pair<int, ii>> v;// cycle, le, ri

#ifdef local
void process(){
    cin >> n >> q;
    for(int i = 1; i <= n; i++) cin >> d[i];
    int lst = d[1], lst2 = 1;
    v.pb({1, {0, 0}});
    for(int i = 2; i <= n; i++){
        if(d[i] > lst){
            v.pb({lst, {lst2, i - 1}});
            int temp = (d[i] + lst - 1) / lst;
            lst *= temp;
            lst2 = i;
        }
    }
    v.pb({lst, {lst2, n}});
    //cin >> q;
    while(q--){
        int t, l, r;
        cin >> t >> l >> r;
       // t--;
        int answer = 0;
        for(auto it : v){
            int temp = (t / it.fi) * it.fi;
            ii b = {-it.se.fi, -it.se.se};
            b.fi += temp, b.se += temp;
            swap(b.fi, b.se);
          //  cout << b.fi << " " << b.se << "\n";
            answer += max(0LL, min(r, b.se) - max(l, b.fi) + 1);
        }
        cout << answer << "\n";
    }
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	process();
}
#endif

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 11ms
memory: 5736kb

input:

499999 499999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1

result:

wrong answer 1st lines differ - expected: '91354', found: '1'

Subtask #2:

score: 12
Accepted

Test #7:

score: 12
Accepted
time: 1ms
memory: 3476kb

input:

999 999
567
214
746
852
643
536
396
114
769
251
631
51
520
952
888
539
19
69
349
813
210
352
216
330
908
156
313
115
339
875
617
174
525
249
176
340
546
649
252
5
778
816
22
166
813
572
8
120
437
442
545
25
100
179
78
808
34
623
606
980
352
784
122
87
263
189
768
815
38
162
98
642
755
585
579
262
11...

output:

2
0
1
1
3
1
2
1
1
0
1
3
2
1
0
3
0
0
0
1
0
3
1
1
0
1
1
1
1
0
1
0
0
1
3
1
0
3
3
0
1
2
3
1
1
1
1
3
1
1
0
1
1
1
1
1
0
0
2
1
1
1
0
0
1
1
1
0
1
3
0
3
3
3
2
1
1
1
1
1
1
1
1
1
1
1
0
3
0
1
0
0
1
1
2
0
1
0
3
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
3
0
0
1
0
2
1
2
0
1
0
0
3
0
0
0
0
1
1
0
0
1
3
2
2
1
3
3
...

result:

ok 999 lines

Test #8:

score: 0
Accepted
time: 1ms
memory: 3404kb

input:

998 998
556
324
129
29
660
950
57
357
473
979
123
726
466
946
120
339
612
255
1000
122
855
404
360
391
897
179
530
956
728
820
933
945
852
859
75
363
151
557
58
631
774
800
355
839
388
194
62
304
605
185
796
271
949
71
31
212
829
895
202
265
591
890
365
707
138
202
270
530
820
593
215
418
815
720
88...

output:

2
0
2
5
0
0
5
5
5
1
1
1
1
0
0
0
1
1
1
1
1
1
5
0
1
1
3
1
1
1
0
1
0
1
3
1
5
2
3
0
5
0
0
4
5
1
0
1
1
0
1
0
1
0
3
0
1
4
5
5
1
1
1
5
1
1
5
1
5
1
1
3
5
1
0
2
0
5
1
0
1
5
0
1
4
1
1
5
0
0
0
1
0
1
1
1
0
0
1
1
0
0
0
1
1
0
5
4
5
4
3
1
0
0
0
0
1
3
5
0
2
0
0
4
0
1
0
3
0
0
0
4
5
1
1
1
3
3
0
0
1
1
0
4
1
0
0
4
0
5
...

result:

ok 998 lines

Test #9:

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

input:

1000 997
908
532
784
349
774
414
161
861
126
910
955
792
465
71
433
902
795
446
179
893
256
102
504
495
796
108
169
724
751
569
477
616
55
961
101
99
4
115
649
437
815
361
232
689
701
159
212
943
351
16
279
227
386
508
751
188
67
951
487
277
317
291
936
44
208
400
135
347
649
681
50
133
225
708
275
...

output:

0
0
1
1
1
0
1
1
0
0
0
0
1
1
0
1
1
1
0
1
4
10
0
1
0
0
1
1
1
0
0
0
0
0
1
0
0
1
0
0
1
1
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
1
0
1
0
1
1
1
1
1
0
1
1
1
1
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
0
1
0
0
0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
5
1
0
0
1
0
1
0
1
0
1
0
0
1
0
0
0
0
1
0
1
1
1
0
0
0
0
0
1
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
1...

result:

ok 997 lines

Test #10:

score: 0
Accepted
time: 1ms
memory: 3408kb

input:

999 1000
581
450
177
453
237
604
809
446
468
512
170
798
612
526
384
308
979
25
110
735
570
339
249
661
337
278
48
230
391
740
705
724
662
479
534
156
10
537
129
982
340
979
868
640
364
835
938
778
997
347
761
187
42
355
882
789
658
835
743
486
96
77
52
129
94
421
345
968
829
117
991
976
975
898
537...

output:

0
0
5
0
1
5
0
6
1
1
4
0
4
0
6
0
1
0
4
2
1
6
1
0
0
6
1
0
1
1
0
1
6
1
1
1
0
1
0
6
4
1
0
0
2
6
1
2
4
0
1
0
0
1
0
0
1
1
0
1
0
1
0
0
1
0
2
0
2
1
0
0
0
1
1
1
0
0
6
1
0
1
6
0
0
2
6
5
1
0
6
0
1
1
4
0
0
1
1
2
1
0
0
3
0
0
1
6
6
3
1
1
1
0
1
2
6
4
0
1
0
3
1
1
0
0
3
6
1
0
5
1
0
1
6
0
0
5
1
0
4
1
1
4
1
0
0
0
6
1
...

result:

ok 1000 lines

Test #11:

score: 0
Accepted
time: 1ms
memory: 3580kb

input:

998 999
1
1
2
2
3
5
5
6
6
6
8
10
10
10
11
11
12
13
15
19
20
24
24
24
24
26
26
26
28
29
30
30
30
31
34
35
35
37
38
39
40
41
43
45
45
45
47
48
49
50
51
54
55
57
59
59
61
62
62
63
64
66
66
67
70
70
70
70
73
73
74
75
76
76
77
77
77
78
79
79
80
80
83
83
83
84
84
85
85
85
87
87
90
91
92
93
94
94
95
96
97
...

output:

128
73
156
27
2
6
510
4
345
18
348
147
4
4
265
146
22
109
175
0
24
69
84
28
117
251
10
11
52
3
226
45
252
25
396
20
55
190
146
8
0
251
0
127
20
335
0
231
65
355
44
140
7
39
187
6
1
15
28
28
83
24
3
0
509
56
0
14
8
0
0
17
275
175
48
175
173
33
434
202
116
10
2
25
34
34
18
20
84
26
29
62
5
59
57
73
9
...

result:

ok 999 lines

Test #12:

score: 0
Accepted
time: 1ms
memory: 3456kb

input:

1000 998
1
2
4
4
5
7
7
7
8
8
8
10
13
18
19
19
20
20
21
21
22
23
23
25
26
26
26
27
28
29
29
31
31
32
34
38
39
39
40
41
41
42
43
44
45
45
47
48
48
49
52
53
54
54
55
56
56
60
61
64
66
69
69
71
72
73
74
76
76
77
78
78
82
83
83
83
83
84
88
88
88
89
90
94
95
95
96
97
97
97
99
99
100
100
102
102
103
104
10...

output:

11
3
86
11
142
22
44
0
41
16
302
176
1
255
156
165
47
126
48
15
45
10
26
500
0
50
402
0
0
10
6
9
346
43
114
186
0
113
125
147
69
32
6
362
40
257
191
60
166
497
274
4
34
223
2
499
244
32
12
1
215
125
139
11
80
22
133
59
319
25
0
213
396
81
45
2
8
20
0
3
250
92
0
46
244
35
191
49
0
59
13
71
281
250
16...

result:

ok 998 lines

Subtask #3:

score: 0
Skipped

Dependency #1:

0%