QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#563061 | #9239. Hieroglyphs | bachbeo2007 | 3 | 28ms | 19192kb | C++23 | 2.0kb | 2024-09-14 01:33:08 | 2024-09-14 01:33:09 |
Judging History
answer
#include "hieroglyphs.h"
#include <bits/stdc++.h>
using namespace std;
const int S = 200001;
vector<int> P,Q;
struct Info{
int p=0;
vector<int> I,cnt,nxt,pos;
Info(vector<int> _I):I(_I){
int N=(int)I.size();
cnt.assign(S,0);
pos.assign(S,N);
nxt.assign(N,N);
for(int i=N-1;i>=0;i--){
int X=I[i];
cnt[X]++;
nxt[i]=pos[X];
pos[X]=i;
}
}
int get(int x){
return cnt[x];
}
void next(){
cnt[I[p]]--;
pos[I[p]]=nxt[p];
p++;
}
void move(int x){
while(p<x) next();
}
void jump(int x){
move(pos[x]);
}
};
vector<int> construct(vector<int> A,vector<int> B){
int N=(int)A.size(),M=(int)B.size();
vector<int> cntA(S),cntB(S);
for(int i=0;i<N;i++) cntA[A[i]]++;
for(int i=0;i<M;i++) cntB[B[i]]++;
vector<int> posA,posB,res;
for(int i=0;i<N;i++) if(cntA[A[i]]<=cntB[A[i]]) posA.push_back(i);
for(int i=0;i<M;i++) if(cntB[B[i]]<cntA[B[i]]) posB.push_back(i);
posA.push_back(N),posB.push_back(M);
auto pA=posA.begin(),pB=posB.begin();
Info fA(A),fB(B),gA(A),gB(B);
gA.move(*pA);gB.move(*pB);
while(*pA!=N || *pB!=M){
bool dA=true,dB=true;
int nA=A[*pA],nB=B[*pB];
if(*pA!=N){
dA&=fB.get(nA)>gB.get(nA);
dB&=gB.get(nA)>=gA.get(nA);
}
else dA=false;
if(*pB!=M){
dB&=fA.get(nB)>gA.get(nB);
dA&=gA.get(nB)>=gB.get(nB);
}
else dB=false;
if(dA==dB) return {-1};
if(dA){
res.push_back(nA);
fB.jump(nA);
swap(fA,gA);
gA.move(*(++pA));
}
else{
res.push_back(nB);
fA.jump(nB);
swap(fB,gB);
gB.move(*(++pB));
}
P.push_back(fA.p);
Q.push_back(fB.p);
}
return res;
}
bool check(vector<int> A,vector<int> B){
return true;
}
std::vector<int> ucs(std::vector<int> A, std::vector<int> B) {
vector<int> res=construct(A,B);
if(res==vector<int>{-1}) return {-1};
if(!check(A,B)) return {-1};
swap(A,B),swap(P,Q);
if(!check(A,B)) return {-1};
return res;
}
詳細信息
Subtask #1:
score: 3
Accepted
Test #1:
score: 3
Accepted
time: 0ms
memory: 10996kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 10 10 7 1 9 2 3 5 0 6 8 4 7 1 9 2 3 5 0 6 8 4
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 10 7 1 9 2 3 5 0 6 8 4
result:
ok
Test #2:
score: 3
Accepted
time: 3ms
memory: 11100kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 10 10 7 9 4 5 6 8 2 1 3 0 7 9 4 5 8 6 2 1 3 0
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
ok
Test #3:
score: 3
Accepted
time: 0ms
memory: 11204kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 1000 1000 227 14 144 355 329 614 282 987 90 67 421 904 584 672 129 286 187 498 450 29 342 688 521 133 585 769 794 138 731 946 28 996 402 935 96 855 2 186 361 1 451 914 318 720 296 389 356 364 400 971 387 979 520 885 604 62 814 474 479 952 394 640 959 246 509 171 486 ...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1000 227 14 144 355 329 614 282 987 90 67 421 904 584 672 129 286 187 498 450 29 342 688 521 133 585 769 794 138 731 946 28 996 402 935 96 855 2 186 361 1 451 914 318 720 296 389 356 364 400 971 387 979 520 885 604 62 814 474 479 952 394 640 959 246 509 171 486 35...
result:
ok
Test #4:
score: 3
Accepted
time: 3ms
memory: 11072kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 997 997 615 691 867 398 544 236 744 802 466 701 700 106 636 993 668 105 409 810 957 249 619 293 729 339 189 537 70 237 487 360 276 693 181 954 85 310 669 52 86 12 209 787 294 188 64 561 828 44 564 480 895 283 289 924 192 783 890 948 674 279 114 229 822 771 458 179 65...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
ok
Test #5:
score: 3
Accepted
time: 28ms
memory: 19140kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 100000 100000 19751 36170 33104 26686 54203 5214 37609 58763 10536 82655 80942 70794 54794 16739 55137 38172 11159 41408 34850 54300 58781 6684 19791 28867 83340 19360 7277 54060 59942 87198 45397 49198 66950 26865 7468 7059 58566 43804 99565 76536 48614 34101 26106 ...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 100000 19751 36170 33104 26686 54203 5214 37609 58763 10536 82655 80942 70794 54794 16739 55137 38172 11159 41408 34850 54300 58781 6684 19791 28867 83340 19360 7277 54060 59942 87198 45397 49198 66950 26865 7468 7059 58566 43804 99565 76536 48614 34101 26106 5596...
result:
ok
Test #6:
score: 3
Accepted
time: 14ms
memory: 17244kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 100000 100000 57387 11861 84433 84680 51764 17643 86122 83141 74972 47794 40972 60391 93655 62206 23852 51121 39250 5924 83139 29296 56131 49532 51226 82006 3512 64857 97761 67854 81216 44976 43459 57540 14182 6532 49925 71980 75037 14724 22961 5863 51568 85048 44306...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
ok
Test #7:
score: 3
Accepted
time: 14ms
memory: 17284kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 100000 100000 84974 12498 84270 93621 94069 64811 16796 8508 5403 97838 69731 94154 34731 38790 45254 19912 63443 17097 25188 8738 22665 3307 92076 63795 24089 54926 82925 31639 81818 84608 65732 50776 53506 41939 34765 62498 39249 80937 95327 706 45760 39603 10343 6...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
ok
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 15
Accepted
time: 17ms
memory: 17236kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 89984 90016 167910 187180 47437 150113 199404 61979 49501 155514 167910 175137 104441 149717 155514 13573 170025 181983 117868 13573 149717 166954 145922 29787 93788 58581 158693 51768 120499 17700 17700 4746 119328 33450 138501 137246 33450 135751 84363 168724 15701...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 60000 187180 47437 150113 199404 61979 49501 167910 175137 104441 155514 170025 181983 117868 13573 149717 166954 145922 29787 93788 58581 158693 51768 120499 17700 4746 119328 138501 137246 33450 135751 84363 168724 157010 108760 44137 113102 139611 199377 86291 ...
result:
ok
Test #9:
score: 15
Accepted
time: 19ms
memory: 17392kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 90003 90000 14155 14155 151711 151711 31573 66800 139383 1925 46366 116207 18428 18428 66618 83155 133084 9526 176340 87155 193385 52734 133084 1925 79878 137917 176340 32150 15872 66618 116207 194766 40942 31265 147928 124727 97615 58260 161323 8229 74777 146601 959...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 60001 14155 151711 31573 66800 139383 46366 18428 83155 9526 87155 193385 52734 133084 1925 79878 137917 176340 32150 15872 66618 116207 194766 40942 31265 147928 124727 97615 58260 161323 8229 74777 146601 37955 95987 118028 29763 15233 101780 54731 36231 65482 3...
result:
ok
Test #10:
score: 0
Wrong Answer
time: 22ms
memory: 17312kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 89985 90021 192793 185974 48491 162906 75646 99166 183316 75646 52957 33987 83321 64287 83321 123979 130761 130761 154020 134587 154020 186921 178874 71496 184891 82981 123873 186777 127271 139973 67220 127271 140236 191126 67220 36003 36003 23064 43454 116351 168977...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 60002 192793 185974 48491 162906 99166 183316 75646 52957 33987 64287 83321 123979 130761 134587 154020 186921 178874 71496 184891 82981 123873 186777 139973 127271 140236 191126 67220 36003 23064 43454 116351 168977 63200 132243 153847 21074 108613 25083 115379 5...
result:
wrong answer 3rd lines differ - on the 1st token, expected: '1', found: '60002'
Subtask #3:
score: 0
Wrong Answer
Test #71:
score: 0
Wrong Answer
time: 6ms
memory: 17204kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 100000 100000 0 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 1 1 0 1 1 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 1 0 1 1 1 0 1 0...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
wrong answer 3rd lines differ - on the 1st token, expected: '85671', found: '1'
Subtask #4:
score: 0
Wrong Answer
Test #97:
score: 16
Accepted
time: 4ms
memory: 13000kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 20000 30000 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 20000 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955...
result:
ok
Test #98:
score: 16
Accepted
time: 15ms
memory: 18476kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 99999 88888 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 224...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 88886 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 ...
result:
ok
Test #99:
score: 16
Accepted
time: 19ms
memory: 18828kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 100000 100000 166304 166304 166304 166304 166304 166304 166304 166304 102708 11497 11497 11497 11497 11497 11497 11497 11497 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 125776 125776 125776 125776 125776 125776 125776 125...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 85709 166304 166304 166304 166304 166304 166304 166304 102708 11497 11497 11497 11497 11497 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 12...
result:
ok
Test #100:
score: 16
Accepted
time: 14ms
memory: 18864kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 100000 100000 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 1...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 95801 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117...
result:
ok
Test #101:
score: 16
Accepted
time: 17ms
memory: 19024kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 100000 100000 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 1...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 98803 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501...
result:
ok
Test #102:
score: 16
Accepted
time: 25ms
memory: 19192kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 100000 100000 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 1...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 99078 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473...
result:
ok
Test #103:
score: 16
Accepted
time: 17ms
memory: 17864kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 90001 89999 171539 66534 9757 176662 84211 83487 129394 86197 172362 142984 93418 146577 96159 191701 83516 196081 37110 105351 165140 54539 124569 187177 24718 194979 119131 15727 40820 31718 13095 147840 76889 199389 75862 118045 115442 10325 157261 11275 83362 174...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 69029 66534 9757 176662 84211 83487 129394 142984 93418 146577 83516 196081 37110 105351 165140 124569 187177 24718 194979 119131 15727 40820 31718 13095 147840 199389 75862 118045 115442 10325 157261 11275 83362 174999 135965 170148 9468 78567 123417 96834 166908...
result:
ok
Test #104:
score: 0
Wrong Answer
time: 10ms
memory: 16436kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 88483 88489 171539 66534 9757 9757 176662 66534 176662 66534 84211 171539 83487 83487 129394 83487 83487 129394 129394 129394 86197 171539 142984 142984 93418 142984 146577 93418 96159 146577 171539 191701 191701 83516 83516 196081 83516 37110 83516 191701 171539 105...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
wrong answer 3rd lines differ - on the 1st token, expected: '49991', found: '1'
Subtask #5:
score: 0
Wrong Answer
Test #132:
score: 14
Accepted
time: 3ms
memory: 11332kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 2800 2999 47 51 42 122 38 125 170 11 119 48 289 297 27 150 207 271 11 15 67 287 149 220 76 274 128 151 60 117 39 123 254 75 170 198 72 179 274 203 13 88 139 153 46 288 13 282 16 219 284 91 274 63 190 157 72 286 238 1 219 82 82 31 285 128 198 172 161 271 36 111 160 26...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 2800 47 51 42 122 38 125 170 11 119 48 289 297 27 150 207 271 11 15 67 287 149 220 76 274 128 151 60 117 39 123 254 75 170 198 72 179 274 203 13 88 139 153 46 288 13 282 16 219 284 91 274 63 190 157 72 286 238 1 219 82 82 31 285 128 198 172 161 271 36 111 160 268 ...
result:
ok
Test #133:
score: 14
Accepted
time: 0ms
memory: 11388kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 2999 2999 161 462 13 332 346 475 194 20 36 323 39 256 432 278 259 480 97 464 354 69 375 262 103 321 65 264 31 471 439 314 169 353 165 346 444 148 337 326 359 397 396 489 391 74 168 209 496 183 481 9 485 46 174 410 158 363 179 56 118 294 350 290 154 74 95 202 490 62 3...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 2700 161 462 13 332 346 475 194 20 36 323 39 256 432 278 259 480 97 464 354 69 375 262 103 321 65 264 31 471 439 314 169 353 165 346 444 148 337 326 359 397 396 489 391 74 168 209 496 183 481 9 485 46 174 410 158 363 179 56 118 294 350 290 154 74 95 202 490 62 397...
result:
ok
Test #134:
score: 0
Wrong Answer
time: 0ms
memory: 11300kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 2999 2999 843 300 400 262 3 359 867 592 609 694 416 694 749 14 997 584 22 452 74 61 908 659 456 301 694 412 793 433 213 885 304 161 506 502 462 654 694 875 983 177 743 313 380 316 473 748 254 659 997 132 100 335 437 825 192 182 213 575 740 442 622 833 694 914 332 341...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
wrong answer 3rd lines differ - on the 1st token, expected: '2500', found: '1'
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%