QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#520863#8650. Island Hoppinggreen_gold_dog#2 6ms4136kbC++20840b2024-08-15 16:47:532024-08-15 16:47:53

Judging History

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

  • [2024-08-15 16:47:53]
  • 评测
  • 测评结果:2
  • 用时:6ms
  • 内存:4136kb
  • [2024-08-15 16:47:53]
  • 提交

answer

#include "island.h"
#include<bits/stdc++.h>

using namespace std;

typedef int ll;

map<pair<ll, ll>, ll> mind;

ll get(ll x, ll y) {
	if (mind.find(make_pair(x, y)) != mind.end()) {
		return mind[make_pair(x, y)];
	}
	return mind[make_pair(x, y)] = query(x + 1, y + 1) - 1;
}

void ans(ll x, ll y) {
	answer(x + 1, y + 1);
}

void solve(ll n, ll l) {
	vector<vector<ll>> to(n);
	vector<ll> col(n, 0);
	ll ost = n - 1;
	for (ll i = 0; i < n; i++) {
		ll start = 0;
		for (auto j : to[i]) {
			if (j < i) {
				start++;
			}
		}
		while (start < n - 1 && ost > 0) {
			ll x = get(i, start);
			if (get(x, col[x]) == i) {
				col[x]++;
				ost--;
				to[i].push_back(x);
				to[x].push_back(i);
			} else {
				break;
			}
			start++;
		}
	}
	for (ll i = 0; i < n; i++) {
		for (auto j : to[i]) {
			if (j > i) {
				ans(i, j);
			}
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 1ms
memory: 3896kb

input:

3 9
3
1
2
3
2
0
0

output:

1 1
3 1
1 2
2 1
3 2
-1 3
-2 3
0 0

result:

ok 

Test #2:

score: 2
Accepted
time: 1ms
memory: 3856kb

input:

3 9
3
1
2
3
2
0
0

output:

1 1
3 1
1 2
2 1
3 2
-1 3
-2 3
0 0

result:

ok 

Test #3:

score: 2
Accepted
time: 1ms
memory: 3888kb

input:

3 9
2
1
3
2
3
0
0

output:

1 1
2 1
1 2
3 1
2 2
-1 2
-2 3
0 0

result:

ok 

Subtask #2:

score: 0
Wrong Answer

Test #4:

score: 0
Wrong Answer
time: 6ms
memory: 3948kb

input:

299 89401
79
1
213
1
20
89
242
2
286
2
129
271
192
3
244
3
6
29
69
4
227
4
148
69
99
5
233
5
178
52
6
244
6
3
272
7
277
7
73
147
54
8
83
8
50
48
67
9
149
9
145
149
72
10
276
10
61
162
163
11
278
11
41
163
196
12
226
12
29
226
216
13
239
13
202
112
60
14
268
14
94
97
225
15
293
15
26
212
101
16
113
1...

output:

1 1
79 1
1 2
213 1
1 3
20 1
2 1
242 1
2 2
286 1
2 3
129 1
3 1
192 1
3 2
244 1
3 3
6 1
4 1
69 1
4 2
227 1
4 3
148 1
5 1
99 1
5 2
233 1
5 3
178 1
29 1
6 2
244 2
6 3
7 1
272 1
7 2
277 1
7 3
73 1
8 1
54 1
8 2
83 1
8 3
50 1
9 1
67 1
9 2
149 1
9 3
145 1
10 1
72 1
10 2
276 1
10 3
61 1
11 1
163 1
11 2
278 1...

result:

wrong answer Wrong Answer [5]

Subtask #3:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 4ms
memory: 4136kb

input:

299 598
43
1
151
1
66
43
91
2
119
2
124
36
7
3
130
3
181
7
115
4
139
4
129
115
50
5
109
5
55
50
157
6
176
6
107
157
181
130
190
106
8
138
8
18
103
147
9
235
9
82
24
44
10
197
10
100
44
31
11
64
11
79
31
150
12
210
12
71
25
195
13
271
13
178
155
113
14
196
14
37
196
265
15
295
15
102
148
171
16
251
1...

output:

1 1
43 1
1 2
151 1
1 3
66 1
2 1
91 1
2 2
119 1
2 3
124 1
3 1
7 1
3 2
130 1
3 3
181 1
4 1
115 1
4 2
139 1
4 3
129 1
5 1
50 1
5 2
109 1
5 3
55 1
6 1
157 1
6 2
176 1
6 3
107 1
7 2
7 3
130 2
8 1
106 1
8 2
138 1
8 3
18 1
9 1
147 1
9 2
235 1
9 3
82 1
10 1
44 1
10 2
197 1
10 3
100 1
11 1
31 1
11 2
64 1
11 ...

result:

wrong answer Wrong Answer [3]

Subtask #4:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 6ms
memory: 3908kb

input:

299 89401
29
1
35
1
171
1
87
35
153
2
230
2
163
230
166
3
181
3
7
166
54
4
266
4
70
54
65
5
159
5
77
132
75
6
176
6
217
75
7
241
7
3
9
8
83
8
22
83
250
9
83
22
88
10
141
10
136
141
19
11
68
19
193
12
224
12
125
63
154
13
215
13
119
154
26
14
228
14
49
228
73
15
221
15
129
131
271
16
50
53
231
17
239...

output:

1 1
29 1
1 2
35 1
1 3
171 1
1 4
87 1
2 1
153 1
2 2
230 1
2 3
163 1
3 1
166 1
3 2
181 1
3 3
7 1
4 1
54 1
4 2
266 1
4 3
70 1
5 1
65 1
5 2
159 1
5 3
77 1
6 1
75 1
6 2
176 1
6 3
217 1
166 2
7 2
241 1
7 3
8 1
9 1
8 2
83 1
8 3
22 1
9 2
250 1
9 3
83 2
10 1
88 1
10 2
141 1
10 3
136 1
11 1
19 1
11 2
68 1
12 ...

result:

wrong answer Wrong Answer [5]

Subtask #5:

score: 0
Wrong Answer

Test #23:

score: 0
Wrong Answer
time: 5ms
memory: 3892kb

input:

299 897
140
1
269
1
276
1
57
256
39
2
121
2
87
34
67
3
86
3
54
86
214
4
262
4
55
214
234
5
244
5
84
159
122
6
146
6
245
146
174
7
240
7
69
131
227
8
237
8
123
227
206
9
281
9
48
91
65
10
275
10
172
241
41
11
254
11
38
41
211
12
272
12
161
211
117
13
199
13
65
199
51
14
165
14
177
165
152
15
207
15
1...

output:

1 1
140 1
1 2
269 1
1 3
276 1
1 4
57 1
2 1
39 1
2 2
121 1
2 3
87 1
3 1
67 1
3 2
86 1
3 3
54 1
4 1
214 1
4 2
262 1
4 3
55 1
5 1
234 1
5 2
244 1
5 3
84 1
6 1
122 1
6 2
146 1
6 3
245 1
7 1
174 1
7 2
240 1
7 3
69 1
8 1
227 1
8 2
237 1
8 3
123 1
9 1
206 1
9 2
281 1
9 3
48 1
10 1
65 1
10 2
275 1
10 3
172 ...

result:

wrong answer Wrong Answer [5]

Subtask #6:

score: 0
Wrong Answer

Test #32:

score: 0
Wrong Answer
time: 0ms
memory: 3964kb

input:

300 90000
133
1
179
1
89
133
82
2
47
82
65
3
165
65
266
4
283
4
48
128
29
5
40
5
59
5
11
29
24
6
35
6
41
6
132
41
28
7
234
7
18
234
86
8
199
86
186
9
299
54
109
10
231
10
271
10
51
109
11
221
11
5
105
12
112
12
131
12
17
131
128
13
277
13
48
117
14
126
14
178
14
29
126
108
15
231
108
247
16
118
77
1...

output:

1 1
133 1
1 2
179 1
1 3
89 1
2 1
82 1
2 2
47 1
3 1
65 1
3 2
165 1
4 1
266 1
4 2
283 1
4 3
48 1
5 1
29 1
5 2
40 1
5 3
59 1
5 4
11 1
6 1
24 1
6 2
35 1
6 3
41 1
6 4
132 1
7 1
28 1
7 2
234 1
7 3
18 1
8 1
86 1
8 2
199 1
9 1
186 1
9 2
299 1
10 1
109 1
10 2
231 1
10 3
271 1
10 4
51 1
29 2
11 2
221 1
11 3
1...

result:

wrong answer Wrong Answer [5]

Subtask #7:

score: 0
Wrong Answer

Test #58:

score: 0
Wrong Answer
time: 4ms
memory: 3896kb

input:

300 900
201
1
228
1
171
10
88
2
262
88
97
3
104
3
101
97
35
4
183
4
236
4
61
34
96
5
98
5
269
5
58
96
70
6
138
6
163
70
60
7
141
7
13
141
23
8
80
8
290
8
112
143
46
9
51
39
76
10
171
40
76
43
11
180
11
206
11
36
43
69
12
203
12
280
12
151
69
13
173
13
7
95
14
168
91
159
15
166
132
264
16
89
110
196
...

output:

1 1
201 1
1 2
228 1
1 3
171 1
2 1
88 1
2 2
262 1
3 1
97 1
3 2
104 1
3 3
101 1
4 1
35 1
4 2
183 1
4 3
236 1
4 4
61 1
5 1
96 1
5 2
98 1
5 3
269 1
5 4
58 1
6 1
70 1
6 2
138 1
6 3
163 1
7 1
60 1
7 2
141 1
7 3
13 1
8 1
23 1
8 2
80 1
8 3
290 1
8 4
112 1
9 1
46 1
9 2
51 1
10 1
76 1
10 2
10 3
40 1
11 1
43 1...

result:

wrong answer Wrong Answer [5]

Subtask #8:

score: 0
Wrong Answer

Test #84:

score: 0
Wrong Answer
time: 0ms
memory: 3848kb

input:

299 598
86
1
94
1
224
94
79
2
228
2
42
57
49
3
166
3
234
23
124
4
138
83
257
5
262
5
296
5
77
110
51
6
129
6
158
6
40
129
214
7
55
51
20
8
206
8
28
20
50
9
64
9
105
9
32
24
177
10
262
77
200
11
209
11
186
26
238
12
150
35
66
13
223
13
122
223
15
14
92
15
92
217
15
20
28
38
16
68
38
229
17
254
187
17...

output:

1 1
86 1
1 2
94 1
1 3
224 1
2 1
79 1
2 2
228 1
2 3
42 1
3 1
49 1
3 2
166 1
3 3
234 1
4 1
124 1
4 2
138 1
5 1
257 1
5 2
262 1
5 3
296 1
5 4
77 1
6 1
51 1
6 2
129 1
6 3
158 1
6 4
40 1
7 1
214 1
7 2
55 1
8 1
20 1
8 2
206 1
8 3
28 1
9 1
50 1
9 2
64 1
9 3
105 1
9 4
32 1
10 1
177 1
10 2
262 2
11 1
200 1
1...

result:

wrong answer Wrong Answer [3]