QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#855030 | #9239. Hieroglyphs | 275307894a# | 3 | 447ms | 10404kb | C++20 | 2.0kb | 2025-01-12 13:00:29 | 2025-01-12 13:00:30 |
Judging History
answer
#include "hieroglyphs.h"
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=2e5+5,M=(1<<28)+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
#ifdef LOCAL
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
#else
#define gdb(...) void()
#endif
}using namespace Debug;
int n,m,A[N],B[N];
int al[N],ar[N],bl[N],br[N];
vector<int> ucs(vector<int> a,vector<int> b) {
n=a.size();m=b.size();
for(int i=1;i<=n;i++) A[i]=a[i-1];
for(int i=1;i<=m;i++) B[i]=b[i-1];
Me(al,0x3f);Me(ar,-0x3f);Me(bl,0x3f);Me(br,-0x3f);
for(int i=1;i<=n;i++) ar[A[i]]=i;
for(int i=n;i;i--) al[A[i]]=i;
for(int i=1;i<=m;i++) br[B[i]]=i;
for(int i=m;i;i--) bl[B[i]]=i;
vector<int> pos;
for(int i=0;i<=200000;i++) if(al[i]<=ar[i]&&bl[i]<=br[i]) pos.push_back(i);
int flag=0;
auto cmp=[&](int x,int y){
if(ar[x]<al[y]) return true;
if(ar[y]<al[x]) return false;
if(br[x]<bl[y]) return true;
if(br[y]<bl[x]) return false;
flag=1;return x<y;
};
sort(all(pos),cmp);
vector<int> ps=pos;
int k=50;while(k--){
shuffle(all(ps),rnd);
sort(all(ps),cmp);
if(ps!=pos) flag=1;
}
for(int i=1;i<pos.size();i++){
int x=pos[i-1],y=pos[i];
if(ar[x]<al[y]&&br[y]<bl[x]) flag=1;
if(br[x]<bl[y]&&ar[y]<al[x]) flag=1;
cmp(x,y);
}
if(flag) return {-1};
return pos;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 3
Accepted
Test #1:
score: 3
Accepted
time: 2ms
memory: 8392kb
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: 1ms
memory: 7740kb
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: 4ms
memory: 8156kb
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: 4ms
memory: 7056kb
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: 447ms
memory: 10404kb
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: 446ms
memory: 9816kb
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: 444ms
memory: 9880kb
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: 423ms
memory: 9232kb
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: 419ms
memory: 9360kb
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: 15
Accepted
time: 419ms
memory: 9064kb
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 1 -1
result:
ok
Test #11:
score: 15
Accepted
time: 424ms
memory: 9384kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 90014 89995 17256 105238 17256 105238 105405 10314 111640 70659 55569 98087 65019 14479 70659 32231 181153 193842 66318 3621 66318 198871 55518 42843 186825 134959 134959 153709 42843 151583 144591 111568 134786 192560 80263 120343 185374 185374 169728 9032 97727 828...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
ok
Test #12:
score: 15
Accepted
time: 427ms
memory: 9276kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 90008 90004 180511 161015 16262 16262 52999 127190 178460 35560 178460 184371 2815 161015 184371 2815 206 127190 87119 33079 23188 23188 186591 160908 53562 144431 177868 127055 197253 117791 177868 188280 194433 194433 144825 44149 70831 56651 56651 96053 80656 7502...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 60004 180511 16262 52999 35560 178460 161015 184371 2815 206 127190 87119 33079 23188 186591 160908 53562 144431 127055 197253 117791 177868 188280 194433 144825 44149 70831 56651 96053 80656 75028 124252 134693 180419 43034 28130 119187 21358 133748 21079 143816 ...
result:
ok
Test #13:
score: 15
Accepted
time: 415ms
memory: 9932kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 90042 89979 29707 12326 194838 29707 99720 55349 103409 69802 30015 69802 12326 137622 175331 97157 62498 39504 155925 44517 112910 44517 82971 149911 62498 45144 186022 58102 148090 186022 75958 75958 183679 164385 109694 189132 148090 176295 112788 42671 178545 170...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
ok
Test #14:
score: 15
Accepted
time: 411ms
memory: 9360kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 89340 89340 183027 184217 184217 19614 137650 162293 154620 154620 95720 19614 62759 95720 106871 18630 106871 64176 46630 136366 85308 61147 85308 61088 61088 61147 72757 72757 146185 128098 164684 195877 194714 174677 174677 132819 99452 120455 158757 88719 12592 7...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
ok
Test #15:
score: 15
Accepted
time: 376ms
memory: 9180kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 81899 81712 133161 60058 7991 191509 24042 172771 119105 93332 20512 20512 93332 129029 59904 80903 128409 6600 80903 152168 142530 15870 48290 18054 18054 152484 129486 12498 97695 140079 142530 12498 105235 138790 117554 48290 105235 97695 10587 13289 114696 159501...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 1 -1
result:
ok
Test #16:
score: 15
Accepted
time: 414ms
memory: 9232kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 89983 90017 62167 5212 172114 166105 156602 182219 49031 129377 149074 172260 96181 146767 50711 21748 87979 167311 167311 173027 10705 37169 56538 126065 11447 137129 27807 112690 98165 3090 136578 60755 64401 178388 64401 33054 126039 119010 161880 178388 106535 10...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 60000 62167 5212 172114 166105 156602 182219 49031 129377 149074 172260 96181 146767 50711 21748 87979 167311 173027 10705 37169 56538 126065 11447 137129 27807 112690 98165 3090 136578 60755 64401 33054 119010 161880 178388 106535 100927 126039 78863 8918 65901 1...
result:
ok
Test #17:
score: 15
Accepted
time: 426ms
memory: 9164kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 90005 89998 159636 17541 123989 19063 155024 162228 15242 198324 56042 147801 15242 80825 198324 155024 29419 188471 114996 164943 114996 14575 55442 160859 80825 21380 146269 167158 59090 7498 104945 178208 7498 10615 2536 117201 2536 61625 38157 178208 70836 61625 ...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 60001 159636 17541 123989 19063 162228 56042 147801 15242 198324 155024 29419 188471 164943 114996 14575 55442 160859 80825 21380 146269 167158 59090 104945 7498 117201 2536 38157 178208 61625 10615 114903 70836 40291 149555 147446 13014 37122 122518 26818 1783 16...
result:
ok
Test #18:
score: 15
Accepted
time: 424ms
memory: 9432kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 90012 89994 7582 147249 52296 167031 79411 107931 147249 154144 164352 164352 154144 164729 164729 8391 107931 52296 63959 23434 40925 54558 65304 56805 44087 129914 129914 13965 29354 165087 10418 165087 81112 28639 119885 119885 108668 152019 184069 18770 197617 48...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 60002 7582 167031 79411 147249 164352 154144 164729 8391 107931 52296 63959 23434 40925 54558 65304 56805 44087 129914 13965 29354 10418 165087 81112 28639 119885 108668 152019 184069 18770 171744 48184 73804 195925 197617 99391 149332 182568 1467 118564 87124 187...
result:
ok
Test #19:
score: 15
Accepted
time: 430ms
memory: 9488kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 90003 90006 121976 121976 175136 60648 60648 46100 84834 70131 34959 102476 101779 115644 58454 189235 107730 73220 73220 165488 2798 105709 25511 96243 114296 96243 81027 138196 114296 75646 101039 101039 8342 9887 9887 75646 8342 17034 156499 169993 164059 114097 1...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 60003 121976 175136 60648 46100 84834 70131 34959 102476 101779 115644 58454 189235 107730 73220 165488 2798 105709 25511 96243 81027 138196 114296 101039 9887 75646 8342 17034 156499 169993 164059 114097 160470 47410 56084 2130 15793 165535 114282 35020 26586 809...
result:
ok
Test #20:
score: 0
Wrong Answer
time: 409ms
memory: 9156kb
input:
vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB 90023 89977 97432 77736 78024 162161 136245 97613 68961 158454 158454 22880 128111 106287 86215 160755 192146 192146 173232 46553 174976 174976 193209 161384 20185 120284 161384 97937 168263 125065 117818 168263 33563 89459 19037 52446 21981 102793 194055 160001 3012...
output:
IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ OK 60000 162161 158454 106287 192146 174976 161384 168263 89459 21981 160001 117926 57202 50581 189860 8223 374 31563 193209 159201 30178 173943 78024 72981 20018 77499 9585 154470 22564 124457 156022 109603 108682 148271 52446 191199 117818 141245 167778 46553 16622...
result:
wrong answer 3rd lines differ - on the 1st token, expected: '1', found: '60000'
Subtask #3:
score: 0
Wrong Answer
Test #71:
score: 0
Wrong Answer
time: 10ms
memory: 8652kb
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: 0
Wrong Answer
time: 4ms
memory: 7924kb
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 39 110955 7003 77556 12701 171483 165117 161693 82544 165639 191736 49075 143290 95615 12313 23610 42920 36085 124043 94305 152453 121345 83096 181427 40325 32407 98034 60069 48187 122046 113266 49921 78832 15378 28982 129401 94912 150349 12080 176459
result:
wrong answer 3rd lines differ - on the 1st token, expected: '20000', found: '39'
Subtask #5:
score: 0
Wrong Answer
Test #132:
score: 0
Wrong Answer
time: 2ms
memory: 7116kb
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 1 -1
result:
wrong answer 3rd lines differ - on the 1st token, expected: '2800', found: '1'
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%