QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#291051#1399. RamenMoRanSky100 ✓0ms3856kbC++23845b2023-12-26 04:37:432023-12-26 04:37:44

Judging History

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

  • [2023-12-26 04:37:44]
  • 评测
  • 测评结果:100
  • 用时:0ms
  • 内存:3856kb
  • [2023-12-26 04:37:43]
  • 提交

answer

#include "ramen.h"

// Skyqwq
#include <bits/stdc++.h>

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

using namespace std;

typedef pair<int, int> PII;
typedef long long LL;

template <typename T> bool chkMax(T &x, T y) { return (y > x) ? x = y, 1 : 0; }
template <typename T> bool chkMin(T &x, T y) { return (y < x) ? x = y, 1 : 0; }


void Ramen(int n) {
  	if (n == 1) {
  		Answer(0, 0);
  		return;
	}
	int o = Compare(0, 1);
	int A, B; int p;
	if (n & 1) {
		A = B = 0;
		p = 1;
	} else {
		if (o == 1) B = 0, A = 1;
		else A = 0, B = 1;
		p = 2;
	}
	for (int i = p; i < n; i += 2) {
		o = Compare(i, i + 1);
		int U, V;
		if (o == 1) V = i, U = i + 1;
		else U = i, V = i + 1;
		if (Compare(U, A) == -1) A = U;
		if (Compare(V, B) == 1) B = V;
	}
	Answer(A, B);
}

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

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

input:

5 1
0
4
3
1
2

output:

Accepted

Test #2:

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

input:

1 1
0

output:

Accepted

Test #3:

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

input:

30 1
18
23
14
9
8
2
20
16
10
28
13
27
24
26
17
21
5
11
6
0
4
7
1
22
15
19
25
12
29
3

output:

Accepted

Test #4:

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

input:

30 2
29
2
18
16
12
3
26
10
21
0
6
20
19
8
27
7
25
1
28
23
11
9
14
22
15
13
4
5
24
17

output:

Accepted

Test #5:

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

input:

29 1
1
26
10
20
7
25
6
14
24
27
23
21
19
9
4
13
22
12
8
17
5
11
28
15
3
2
16
18
0

output:

Accepted

Subtask #2:

score: 30
Accepted

Test #6:

score: 30
Accepted
time: 0ms
memory: 3732kb

input:

299 1
74
124
41
210
26
60
131
241
77
44
107
69
63
22
16
58
196
113
75
170
48
5
10
231
249
188
275
270
142
98
14
61
255
38
276
160
225
81
157
2
59
130
242
20
257
256
298
91
11
15
295
230
120
204
192
238
293
296
251
285
78
29
12
279
181
272
121
179
27
222
208
273
237
239
40
200
149
25
253
90
86
218
21...

output:

Accepted

Test #7:

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

input:

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

output:

Accepted

Test #8:

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

input:

300 2
45
17
187
52
171
262
226
75
238
65
254
39
73
16
0
222
146
26
11
294
108
118
191
120
10
4
38
195
257
279
172
259
232
289
236
64
93
53
77
144
127
48
247
167
68
154
219
155
156
183
128
42
98
291
169
121
132
30
135
256
214
136
165
33
138
261
270
161
25
8
283
148
67
229
81
3
268
160
69
47
111
143
8...

output:

Accepted

Test #9:

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

input:

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

output:

Accepted

Test #10:

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

input:

300 1
293
273
295
22
183
173
263
242
277
66
84
109
189
97
176
91
115
52
87
199
224
253
13
238
237
163
142
37
38
159
63
18
235
291
290
205
233
267
283
68
141
228
39
3
223
227
125
127
182
104
174
54
98
150
139
96
207
275
241
195
126
14
42
11
208
48
288
28
70
229
214
58
248
279
113
146
23
180
145
122
8...

output:

Accepted

Subtask #3:

score: 50
Accepted

Test #11:

score: 50
Accepted
time: 0ms
memory: 3704kb

input:

350 2
233
339
113
57
114
187
344
14
83
140
208
299
135
292
277
181
137
49
226
96
311
307
270
7
201
203
63
108
241
195
75
61
213
111
165
347
102
172
33
186
168
27
178
192
280
4
256
53
86
136
267
295
133
329
35
349
320
257
296
101
177
93
180
328
189
306
287
325
99
157
182
16
260
36
126
254
107
162
258...

output:

Accepted

Test #12:

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

input:

375 2
3
42
133
260
263
100
324
85
349
255
124
333
138
297
247
24
5
205
313
139
179
129
87
6
233
357
96
328
188
83
116
289
290
351
181
37
226
163
256
97
362
29
4
369
137
161
135
345
34
89
193
153
88
281
236
209
28
140
82
228
104
330
276
143
156
273
79
224
41
50
303
72
238
230
365
274
54
62
294
275
22...

output:

Accepted

Test #13:

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

input:

400 2
120
267
94
88
314
279
216
93
87
50
332
192
296
146
353
73
22
241
113
280
54
335
127
157
257
218
67
175
382
377
389
313
60
66
386
21
364
325
291
321
334
343
82
299
29
63
355
173
253
265
132
18
226
180
399
79
142
187
99
40
159
387
161
228
220
254
134
183
96
227
7
27
11
2
363
33
51
347
174
160
37...

output:

Accepted

Test #14:

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

input:

400 1
171
314
280
22
205
111
37
84
82
309
160
307
304
133
286
25
352
213
75
65
329
55
221
43
247
376
274
359
158
60
197
144
0
88
146
277
38
254
1
345
287
223
135
338
284
382
349
98
191
260
54
66
322
53
103
201
141
149
242
79
143
155
123
154
115
110
288
312
32
175
113
50
230
76
148
182
17
258
80
200
...

output:

Accepted

Test #15:

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

input:

399 2
200
96
229
384
62
197
102
223
259
88
2
18
241
337
129
60
40
160
395
52
266
44
189
367
28
201
262
217
87
148
130
108
67
199
3
50
359
35
375
365
206
92
168
163
49
219
164
336
187
42
214
99
113
240
55
14
282
218
341
295
261
107
128
286
17
11
132
101
100
322
8
123
236
323
120
276
342
139
54
172
22...

output:

Accepted

Extra Test:

score: 0
Extra Test Passed