QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#508380#7660. Investigating Frog Behaviour on Lily Pad PatternsUmokRE 358ms20048kbC++201.3kb2024-08-07 14:21:572024-08-07 14:21:58

Judging History

This is the latest submission verdict.

  • [2024-08-07 14:21:58]
  • Judged
  • Verdict: RE
  • Time: 358ms
  • Memory: 20048kb
  • [2024-08-07 14:21:57]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int long long
#define uint unsigned long long
#define lb(x) (x & (-x))
#define endl '\n'
#define INF LONG_LONG_MAX
#define eps 1e-7
const int N = 2e5 + 5;
typedef pair<int, int> PII;
int ar[3 * N];
int n, idx = 0, q;
int find(int x)
{
    int l = 0, r = idx + 1;
    while (l + 1 < r)
    {
        int mid = (l + r) >> 1;
        if (ar[mid] <= x)
            l = mid;
        else
            r = mid;
    }
    return r;
}
void solve()
{
    idx = 0;
    cin >> n;
    map<int, int> mp;
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        mp[i] = x;
        if (i != 1)
        {
            int x = mp[i - 1] + 1;
            if (x >= mp[i])
                continue;
            for (int j = x; j < mp[i]; j++)
            {
                ar[++idx] = j;
            }
        }
    }
    for (int i = mp[n] + 1; i <= mp[n] + N; i++)
    {
        ar[++idx] = i;
    }

    cin >> q;
    while (q--)
    {
        int x;
        cin >> x;
        int st = find(mp[x]);
        int t = ar[st];
        ar[st] = mp[x];
        mp[x] = t;
        cout << t << endl;
    }
}
signed main()
{
    IOS;
    solve();
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 6184kb

input:

5
1 2 3 5 7
3
1
2
4

output:

4
6
8

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 2ms
memory: 6412kb

input:

5
1 2 3 5 7
4
1
1
1
1

output:

4
6
8
9

result:

ok 4 lines

Test #3:

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

input:

5
1 2 3 4 5
20
1
4
4
3
5
3
3
5
2
2
5
4
1
4
2
3
1
5
3
3

output:

6
7
8
4
7
5
9
10
3
4
11
10
7
12
5
10
8
13
11
14

result:

ok 20 lines

Test #4:

score: 0
Accepted
time: 2ms
memory: 6572kb

input:

10
2 4 6 7 8 9 10 12 13 14
1000
4
5
4
6
2
5
2
9
6
10
6
2
1
3
7
3
9
5
2
10
8
7
6
7
4
7
9
4
4
4
5
2
6
1
10
9
10
3
7
10
5
9
5
8
4
8
10
9
1
7
10
8
10
6
7
7
10
8
1
2
9
10
2
3
8
7
2
7
2
2
1
10
3
3
2
8
9
6
10
1
7
9
10
6
5
9
9
6
4
9
10
3
3
10
5
4
8
5
8
4
9
5
5
3
9
7
5
5
4
6
1
8
6
7
9
2
2
4
9
3
6
4
6
8
4
4
3...

output:

11
15
16
11
5
17
7
15
13
18
14
8
3
7
11
9
19
20
10
21
13
12
15
14
17
16
22
18
19
23
24
11
17
4
25
26
27
10
18
28
25
27
26
14
24
15
29
28
5
19
30
16
31
18
20
21
32
17
6
12
29
33
13
11
19
22
14
23
15
16
7
34
12
13
17
20
30
19
35
8
25
31
36
21
27
32
33
22
26
34
37
14
15
38
28
27
21
29
23
28
35
30
31
16...

result:

ok 1000 lines

Test #5:

score: 0
Accepted
time: 2ms
memory: 6220kb

input:

20
1 2 3 4 6 7 8 9 10 11 12 13 14 15 17 18 20 21 22 24
1000
5
13
20
2
2
3
3
16
6
9
4
16
13
6
10
4
14
13
10
18
17
16
2
11
10
11
16
15
16
8
20
7
2
15
9
2
10
7
15
9
7
11
7
18
10
20
1
12
6
9
19
17
4
7
13
8
17
7
14
1
17
11
17
1
4
4
4
5
14
1
14
6
13
3
3
16
20
13
9
20
1
11
2
12
15
2
9
7
3
6
15
7
11
12
17
5...

output:

16
19
25
5
6
5
14
23
18
24
5
26
23
19
18
7
27
28
23
29
21
30
10
15
26
18
31
20
32
11
30
9
12
23
25
15
31
10
24
26
12
20
17
33
34
31
2
18
23
29
25
22
8
19
30
12
26
21
28
3
27
22
35
4
9
10
11
17
36
5
37
26
36
16
19
38
32
39
30
36
6
23
16
20
27
18
31
22
21
28
29
24
26
22
40
19
23
27
30
41
37
32
42
29
3...

result:

ok 1000 lines

Test #6:

score: 0
Accepted
time: 314ms
memory: 19456kb

input:

200000
1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 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 64 65 66 67 68 69 71 72 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 103 105 106...

output:

215571
100166
33910
74113
183009
35730
95221
38280
159508
31446
200325
63195
144358
159370
85773
174154
93179
70073
18863
199520
178155
51882
27205
24526
90730
5933
103897
100965
21694
32932
196760
120608
120432
29259
176329
109263
54123
175078
92336
1475
146000
40528
145231
71028
19163
9144
116467
...

result:

ok 200000 lines

Test #7:

score: 0
Accepted
time: 348ms
memory: 19100kb

input:

200000
2 4 5 7 9 10 11 12 13 17 18 19 20 21 23 24 26 29 30 31 32 33 35 37 38 43 44 45 47 50 52 53 54 55 57 59 60 61 62 65 67 68 70 72 77 79 83 85 87 88 89 90 91 92 93 95 96 99 100 101 102 103 105 106 107 109 110 112 113 115 116 117 119 121 122 123 124 125 127 128 130 131 133 134 135 139 141 144 145 ...

output:

151466
121301
125873
15226
35162
279733
217358
258924
5517
276378
172081
285612
241648
183970
187668
69220
125309
133410
236437
1365
91007
125675
118032
96887
284142
25335
205957
243673
179668
5453
55167
76092
195880
114191
116674
271843
41960
241914
18880
34675
163065
58399
35116
32385
220124
19948...

result:

ok 200000 lines

Test #8:

score: 0
Accepted
time: 358ms
memory: 20048kb

input:

200000
1 2 5 6 11 13 14 16 17 18 19 20 24 25 26 27 28 29 30 31 32 34 35 36 37 38 40 43 45 46 49 53 54 57 59 60 62 63 64 65 66 67 68 69 71 72 73 74 75 77 80 82 83 84 87 88 89 90 91 92 93 94 97 98 101 102 104 107 111 112 113 114 115 119 120 121 123 124 129 137 145 148 149 152 153 155 156 159 162 169 1...

output:

262914
125976
207076
80655
140895
259977
8745
291715
327545
247110
9761
397685
147292
386602
45641
92763
289336
240
210317
254891
351326
229778
178860
123530
8522
32313
38316
152660
24676
253424
266448
148652
379430
375701
46670
378244
137291
305817
121107
208831
324641
90278
155786
162593
354706
28...

result:

ok 200000 lines

Test #9:

score: 0
Accepted
time: 162ms
memory: 8844kb

input:

33921
2 8 21 29 33 34 36 44 57 64 73 93 95 96 101 105 108 114 116 120 127 132 137 157 164 183 187 190 195 196 203 206 234 246 248 257 258 266 271 273 274 289 292 297 299 308 312 318 320 324 327 343 344 349 367 369 375 377 379 387 389 390 391 392 398 402 408 419 420 421 424 432 441 448 451 460 462 47...

output:

26070
4966
176037
73625
129369
149491
83528
183529
52788
5655
41377
116759
49935
146111
197201
162026
156196
168871
86279
53643
147047
162777
26823
63509
113088
62767
134868
9486
133281
66613
199049
119864
129984
115144
95886
26692
19049
8421
140223
193424
63408
117354
163360
4772
179076
40125
12561...

result:

ok 200000 lines

Test #10:

score: 0
Accepted
time: 123ms
memory: 9004kb

input:

13537
13 16 20 29 50 68 101 112 150 158 160 169 174 180 190 192 195 206 207 251 257 261 285 286 297 304 310 327 333 352 361 365 371 393 396 455 486 493 505 521 528 538 551 575 607 617 623 628 650 670 755 775 778 789 795 801 812 841 846 848 884 909 912 918 927 929 938 975 979 999 1012 1026 1046 1055 ...

output:

136700
27206
187164
177867
141751
179244
89337
162697
123835
102153
166144
157069
149195
137753
103182
187249
93790
108052
74818
174535
126905
27860
10170
124840
139067
170622
179253
98497
39123
132361
123025
85118
22169
190588
146855
138166
95956
175765
66595
196704
177966
5548
181609
136059
156126...

result:

ok 200000 lines

Test #11:

score: 0
Accepted
time: 285ms
memory: 17496kb

input:

181035
1 2 3 4 5 6 7 8 9 10 11 12 13 14 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...

output:

25799
98678
144452
4880
74901
16361
193493
22615
32296
83309
86713
118061
38803
152680
161994
56716
44764
153798
137362
190635
136990
133884
170229
196819
64813
123126
197445
49958
176868
151525
177256
97095
8420
179967
35990
78377
141836
97716
54669
118738
125492
32801
180837
16508
73117
184613
188...

result:

ok 200000 lines

Test #12:

score: 0
Accepted
time: 286ms
memory: 14956kb

input:

121774
2 4 8 9 11 12 13 14 17 26 30 31 37 40 50 51 52 53 61 62 65 68 69 77 84 85 87 88 91 94 96 99 101 103 108 119 125 128 135 139 148 150 151 152 155 157 159 160 175 177 179 183 184 185 186 195 198 201 206 213 215 217 218 220 221 222 228 231 233 236 246 248 252 256 260 266 268 269 271 274 276 279 2...

output:

357470
161984
103227
189696
184983
122177
149823
150217
370722
275839
62486
171758
294518
289783
165997
337192
120815
365040
71417
134193
198381
357524
63456
216376
250131
79047
76917
115705
147605
278722
342171
202260
357630
108667
333075
292180
265908
280653
161412
58503
284186
370170
18288
346015...

result:

ok 200000 lines

Test #13:

score: 0
Accepted
time: 164ms
memory: 9408kb

input:

21414
6 15 52 54 59 64 76 89 115 148 157 165 175 177 178 181 207 214 231 233 239 281 290 301 380 445 463 478 480 488 528 550 572 622 624 651 657 685 692 738 740 759 765 797 876 879 881 891 892 905 926 934 1017 1036 1109 1124 1145 1197 1220 1224 1226 1242 1244 1246 1261 1264 1269 1286 1309 1324 1329 ...

output:

244867
94734
216295
30184
239334
1540
151836
390235
8591
213646
216673
332279
268205
322750
124413
155154
246170
241890
383004
178277
365925
268445
160793
47790
100123
35788
227182
392371
321941
1676
243838
337531
276586
73473
167518
100005
13510
292269
223277
115229
342118
142011
165416
164638
2166...

result:

ok 200000 lines

Test #14:

score: 0
Accepted
time: 198ms
memory: 10472kb

input:

41103
25 40 47 64 72 85 91 108 113 114 118 119 143 152 174 185 199 225 227 229 251 255 257 262 263 289 294 310 334 341 349 350 359 360 364 367 372 383 389 393 400 412 416 429 455 464 478 495 513 524 536 538 556 581 586 596 597 599 606 621 626 639 645 658 684 697 699 701 715 728 729 731 738 751 759 7...

output:

64180
228373
158214
397127
178932
311215
49532
11108
344363
226180
225794
230854
358848
214408
40643
108252
383645
220572
267788
22056
18417
200489
16034
212203
260907
380419
196923
202853
368403
321424
255274
284881
84418
28977
26052
365319
230842
300487
95959
247213
325857
108185
15644
65325
23814...

result:

ok 200000 lines

Test #15:

score: -100
Runtime Error

input:

149809
3 6 7 9 22 28 29 38 39 40 41 46 59 61 69 80 85 86 87 91 98 102 103 107 112 113 114 123 131 133 136 142 148 155 162 168 173 176 181 183 193 198 203 208 212 237 242 248 250 256 260 267 273 274 276 278 282 285 289 290 294 301 302 303 304 305 308 310 320 332 334 336 337 340 341 350 352 354 362 36...

output:


result: