QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#855020#9239. Hieroglyphs275307894a#0 7ms8892kbC++202.0kb2025-01-12 12:46:442025-01-12 12:46:44

Judging History

This is the latest submission verdict.

  • [2025-01-12 12:46:44]
  • Judged
  • Verdict: 0
  • Time: 7ms
  • Memory: 8892kb
  • [2025-01-12 12:46:44]
  • Submitted

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);
	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);
	} 
	for(int i=0;i<pos.size();i++) for(int j=i+1;j<pos.size();j++) assert(cmp(pos[i],pos[j]));
	if(flag) return {-1};
	return pos;

}

详细

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 3
Accepted
time: 1ms
memory: 6904kb

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: 2ms
memory: 7208kb

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: 2ms
memory: 7324kb

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: 2ms
memory: 7000kb

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: 0
Time Limit Exceeded

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:


result:


Subtask #2:

score: 0
Time Limit Exceeded

Test #8:

score: 0
Time Limit Exceeded

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:


result:


Subtask #3:

score: 0
Wrong Answer

Test #71:

score: 0
Wrong Answer
time: 7ms
memory: 8892kb

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: 2ms
memory: 7892kb

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
Runtime Error

Test #132:

score: 0
Runtime Error

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:


result:


Subtask #6:

score: 0
Skipped

Dependency #1:

0%