QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#464836#4205. Art CollectionsDan4Life0 1322ms66584kbC++231.3kb2024-07-06 15:20:092024-07-06 15:20:09

Judging History

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

  • [2024-07-06 15:20:09]
  • 评测
  • 测评结果:0
  • 用时:1322ms
  • 内存:66584kb
  • [2024-07-06 15:20:09]
  • 提交

answer

#include "art.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using ar2 = array<int,2>;
using ar3 = array<int,3>;
using ll = long long;
const int mxN = 4010;

int n;
vector<int> v;
bool better[mxN];
map<vector<int>,int> M;

int myPublish(vector<int> V){
	if(M.count(V)) return M[V];
	return M[V] = publish(V);
}

void recur(int l, int r){
	if(l>=r) return;
	
	int xd = (r-l+1);
	for(int i = l; i <= r; i++) 
		better[v[i]]=0;
	int st = myPublish(v);
	if(st==0) return;
	random_shuffle(begin(v)+l,begin(v)+r+1);
	int cnt = 0;
	while(xd-- and cnt<=(r-l+1)/2){
		int b = v[r];
		v.erase(begin(v)+r);
		v.insert(begin(v)+l,b);
		int now = myPublish(v);
		if(now <= st) better[b]=1,cnt++;
		st = now;
	}
	vector<int> nw; nw.clear();
	for(int i = 0; i < l; i++) nw.pb(v[i]);
	for(int i = l; i <= r; i++) if(better[v[i]]) nw.pb(v[i]);
	for(int i = l; i <= r; i++) if(!better[v[i]]) nw.pb(v[i]);
	for(int i = r+1; i < n; i++) nw.pb(v[i]);
	v.clear(); for(auto u : nw) v.pb(u);
	int mid = (l+r)/2; recur(l,mid); recur(mid+1,r);
}

void solve(int N) {
	n = N; srand(time(NULL));
	v.resize(N,0);
    iota(all(v),1);
    random_shuffle(all(v));
	recur(0,N-1); answer(v);
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

6
8
9
6
7
10
5
10
6
9
7
7
3
5
5
4

output:

942318468 6 2 6 3 1 5 4
942318468 6 4 1 6 2 3 5
942318468 6 5 4 1 6 2 3
942318468 6 3 5 4 1 6 2
942318468 6 2 3 5 4 1 6
942318468 6 6 2 3 5 4 1
942318468 6 1 6 2 3 5 4
942318468 6 6 5 1 2 3 4
942318468 6 1 5 6 2 3 4
942318468 6 6 1 5 2 3 4
942318468 6 5 6 1 2 3 4
942318468 6 6 5 1 4 3 2
942318468 6 ...

result:

wrong answer Wrong Answer

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 3ms
memory: 3988kb

input:

40
383
368
341
376
365
380
399
422
455
426
417
412
417
384
365
342
303
342
343
354
371
378
407
428
431
462
489
464
443
426
395
420
457
442
405
370
383
380
367
366
359
202
205
192
191
200
185
180
185
168
179
160
173
190
181
196
197
186
189
208
201
198
145
138
147
140
143
140
145
144
151
142
143
128
1...

output:

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

result:

wrong answer Wrong Answer

Subtask #3:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 23ms
memory: 5904kb

input:

250
14664
15424
15211
15380
15537
15452
15665
15652
15613
15426
15611
15444
15641
15576
15645
15412
15409
15448
15547
15730
15529
15426
15347
15424
15413
15346
15467
15226
15403
15306
15299
15418
15417
15622
15427
15586
15829
15978
16029
15896
16069
16160
16299
16334
16355
16156
16371
16174
16329
16...

output:

942318468 250 205 121 77 237 101 163 181 145 208 175 159 247 224 67 214 190 97 39 59 120 24 37 150 199 194 68 91 193 28 215 64 1 155 3 26 43 21 161 218 144 85 34 62 143 212 127 246 217 86 104 83 140 169 195 84 230 75 87 240 204 76 157 146 238 81 42 201 206 147 209 126 226 148 100 105 166 94 220 235 ...

result:

wrong answer Wrong Answer

Subtask #4:

score: 0
Wrong Answer

Test #20:

score: 0
Wrong Answer
time: 114ms
memory: 11028kb

input:

444
49843
50072
49813
50172
49937
49902
49591
49580
49671
49376
49623
49928
49641
49742
50157
50174
49769
49616
49773
49992
49905
50014
49605
49790
49551
49434
49709
49824
49741
49302
49433
49224
49577
49544
49467
49554
49167
48954
49125
49016
48669
48872
48867
48972
48707
48338
48607
48518
48795
48...

output:

942318468 444 303 121 439 405 101 163 181 419 208 256 364 247 224 322 349 190 97 337 59 311 374 37 150 199 194 68 424 193 28 379 341 1 155 279 26 43 441 431 218 299 316 277 320 143 333 127 246 217 86 104 347 140 328 195 393 355 75 87 240 396 282 157 335 238 435 42 201 206 291 403 297 226 252 100 283...

result:

wrong answer Wrong Answer

Subtask #5:

score: 0
Wrong Answer

Test #26:

score: 0
Wrong Answer
time: 517ms
memory: 35552kb

input:

2000
1033830
999670
1000997
1001666
1000509
1000600
1001553
1000668
1000525
1001632
1001151
1000020
1001329
1001442
1000997
1002062
1000383
1001102
1002275
1001056
999415
1001148
1001139
1002184
1000921
1001000
1000819
999630
1000319
1002266
1002279
1001170
1000643
1002148
1002979
1004516
1004387
10...

output:

942318468 2000 808 1105 516 1496 1307 340 1943 1491 1973 89 725 38 287 93 601 31 230 1193 1276 1949 352 17 1409 559 576 1727 1763 1839 726 1638 33 356 364 163 122 837 880 459 1844 711 1749 1070 687 348 539 1322 1617 319 663 79 1933 1519 1291 118 1930 92 1612 796 1106 995 510 34 1538 1672 1036 1590 8...

result:

wrong answer Too many queries

Subtask #6:

score: 0
Wrong Answer

Test #32:

score: 0
Wrong Answer
time: 1322ms
memory: 66584kb

input:

4000
3964556
4017127
4013420
4011917
4008424
4006013
4007110
4006093
4006474
4005341
4005508
4006883
4010814
4009289
4011056
4008877
4005800
4009661
4013118
4016187
4013870
4016997
4020288
4022465
4021050
4019031
4016930
4018091
4020108
4023727
4020818
4023385
4020740
4024489
4020540
4022615
4021406...

output:

942318468 4000 2888 1575 2848 2216 3385 3932 2804 1843 780 3975 300 2053 3038 1784 159 976 2380 3527 2847 2246 640 3005 1342 2951 930 704 2535 3637 1169 1760 3848 407 2627 3463 1859 2453 2424 1579 915 3355 3915 755 2498 2015 1173 3603 2251 293 2619 3670 3542 3323 651 2158 1165 462 3551 1654 3687 232...

result:

wrong answer Too many queries