QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#744248#7492. 即便看不到未来TheZone0 1821ms172676kbC++201.9kb2024-11-13 21:19:022024-11-13 21:19:03

Judging History

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

  • [2024-11-13 21:19:03]
  • 评测
  • 测评结果:0
  • 用时:1821ms
  • 内存:172676kb
  • [2024-11-13 21:19:02]
  • 提交

answer

#include<algorithm>
#include<vector>
#include<cstdio>
#include<cctype>
using namespace std;
typedef long long LL;
const unsigned U1=-1;
namespace fastread{
	char C[(int)1e8],*buf=C;
	inline void init(){C[fread(C,1,(int)1e8-1,stdin)]='\n';fclose(stdin);}
	inline int readint(){
		int d=0;
		while(!isdigit(*buf))++buf;
		while(isdigit(*buf))d=d*10+(*buf++^'0');
		return d;
	}
}
char FW[(int)2e7],*buf=FW;
const int N=1e6+5;
int n,m,a[N],pre[N],ans[N][11];
bool vis[N];
vector<LL>num,vec[N];
int b[11][N];
inline void add(int i,int x,const int&p){for(;i<=n;i+=i&-i)b[p][i]+=x;}
inline int ask(int i,const int&p){int x=0;for(;i;i^=i&-i)x+=b[p][i];return x;}
inline void modify(int l,int r,int x,const int&p){add(l,x,p),add(r+1,-x,p);}
int main(){
	fastread::init();
	n=fastread::readint(),m=fastread::readint();
	for(int i=1;i<=n;++i)a[i]=fastread::readint();
	for(int i=1;i<=m;++i){
		int l=fastread::readint(),r=fastread::readint();
		vec[r].push_back((LL)l<<32|i);
	}
	for(int it=1;it<=n;++it){
		const int v=a[it],mn=max(1,v-11),mx=min(1000000,v+11);
		num.clear();
		for(int i=mn;i<=mx;++i)
			if(pre[i]&&pre[i]>pre[v])num.push_back((LL)pre[i]<<32|i);
		num.push_back((LL)it<<32|v),num.push_back((LL)pre[v]<<32|1000002);
		sort(num.rbegin(),num.rend());
		for(int i=0;i<num.size()-1;++i){
			int l=0,r=0;
			vis[num[i]&U1]=1;
			while(v-l-1&&l<=10&&vis[v-l-1])++l;
			while(v+r+1<=1000000&&r<=10&&vis[v+r+1])++r;
			const int all=l+r+1;
			if(l&&l<=10)modify((num[i+1]>>32)+1,num[i]>>32,-1,l);
			if(r&&r<=10)modify((num[i+1]>>32)+1,num[i]>>32,-1,r);
			if(all<=10)modify((num[i+1]>>32)+1,num[i]>>32,1,all);
		}
		pre[v]=it;
		for(int i:num)vis[i]=0;
		for(LL i:vec[it])
			for(int j=1;j<=10;++j)
				ans[i&U1][j]=ask(i>>32,j)%10;
	}
	for(int i=1;i<=m;++i,*buf++='\n')
		for(int j=1;j<=10;++j)
			*buf++=ans[i][j]^'0';
	fwrite(FW,1,buf-FW,stdout);
	return 0;
}

詳細信息


Pretests


Final Tests

Test #1:

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

input:

1000 1000
187 934 698 342 646 531 883 803 296 794 297 882 981 92 491 416 273 530 685 53 159 588 606 239 970 803 835 437 976 136 474 788 570 602 648 310 470 796 356 182 141 236 98 517 333 542 353 337 592 63 533 840 955 650 797 785 448 462 982 19 980 318 918 268 362 864 842 756 382 215 841 311 939 953...

output:

0521000000
1442100000
6916310000
1582200000
2742100000
6412000000
0673200000
4400000000
4310000000
5550000000
6283000000
5156140100
4912913121
4111100000
4940000000
9903822111
0236350010
5300000000
9141622111
2100000000
0351341000
8720000000
0710000000
2217100000
5106913200
3000000000
3211000000
940...

result:

FAIL Expected integer, but "0521000000" found (/var/uoj_data/7492/1.out)

Test #2:

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

input:

10000 10000
986 168 918 5602 824 3521 1101 4690 1660 2533 1395 7132 1395 7172 1886 3719 2240 7488 7117 2240 6009 2193 2462 3242 6377 1042 5397 9656 3917 8066 5900 3636 1127 2884 5389 7324 9422 6831 8074 7472 8619 6159 9382 3701 2990 1490 2410 4949 8919 4860 4209 2124 4734 7411 3307 7580 9051 1908 31...

output:

6020000000
3920000000
2561721000
5271830100
6634444232
9015293100
6196130010
5106410000
3451547420
3700000000
9507041200
8026727311
7207410000
1866551000
4441000000
4918810330
0830000000
1504092397
9214100000
6956200000
8630000000
7857100000
7843420402
0430000000
4045100000
4943410000
1934599053
083...

result:

FAIL Expected integer, but "0830000000" found (/var/uoj_data/7492/2.out)

Test #3:

score: 0
Wrong Answer
time: 28ms
memory: 20336kb

input:

30000 30000
7073 5645 1931 1295 24911 27524 29393 21487 26699 29537 28588 23369 21505 11807 9491 29907 29233 12657 29967 22120 24143 20811 11136 6904 29412 19335 26534 14693 26379 21874 3016 18295 23701 14076 12817 27977 24582 76 18030 5386 26997 23545 23233 11597 19040 9713 11361 22041 17126 21318 ...

output:

5116000000
3810000000
3478156300
0221640010
1306891862
3975440792
2220000000
7942182945
2121100000
5211000000
1298810000
9468427040
2483000000
2672000000
9400000000
4396422380
7100000000
4167720000
1696221461
0970384330
8051200000
8123988580
1510600000
7826403430
7074921000
1310621010
2320000000
879...

result:

FAIL Expected integer, but "0221640010" found (/var/uoj_data/7492/3.out)

Test #4:

score: 0
Wrong Answer
time: 81ms
memory: 31680kb

input:

100000 100000
93945 65645 58366 69901 98882 39559 68888 98809 31151 81778 46666 74051 84368 52984 90981 84009 86457 10252 45216 97230 44961 90818 44818 14073 10565 50867 83292 91924 25986 2074 40605 55278 51198 8057 94523 82585 54208 86645 61473 45261 29171 21173 75420 9443 17799 11431 5020 40091 25...

output:

8330820834
4867868300
2916600000
4520000000
6244920010
5307824100
4515491000
7684995683
3953544311
5631904111
6000000000
7510000000
9507817200
4004511833
1877572327
1553661878
1100000000
6349700100
2542774210
4382722811
8254000000
0659092228
5776676657
2004821000
0518408310
8528330000
5430000000
806...

result:

FAIL Expected integer, but "0659092228" found (/var/uoj_data/7492/4.out)

Test #5:

score: 0
Wrong Answer
time: 190ms
memory: 46296kb

input:

200000 200000
105914 65088 118636 62365 48353 20307 181462 136510 114209 32111 5308 34529 79841 140079 100823 141253 110411 129428 173282 199499 179086 130754 19103 60024 70172 14783 118995 14966 140269 144376 21637 133139 161211 136636 71428 182464 194180 120638 199646 20116 6922 139223 73833 5447 ...

output:

3316200000
1111045396
0921200000
8319000000
5396790500
9327239378
6818610000
0258943000
7411783100
0607821100
6598200000
1751345963
4273011000
4064200000
0615200000
7540559941
3554064511
3100000000
8242456650
7751237773
2210000000
3731784120
9474205623
6217259410
4054337301
9097320000
0953280000
844...

result:

FAIL Expected integer, but "0921200000" found (/var/uoj_data/7492/5.out)

Test #6:

score: 0
Wrong Answer
time: 307ms
memory: 67140kb

input:

300000 300000
23658 131165 262645 280095 2422 295214 62536 229220 99152 55876 173549 216784 257232 195420 228558 227714 222611 80472 231034 218687 57306 219197 60195 63630 135306 278454 12096 67930 281674 11663 193581 135571 5384 236091 259654 238189 117524 246127 54992 25407 260995 108740 36721 279...

output:

8400000000
0605122330
1540300000
7411000000
6426525510
6712000000
6243592060
9460433237
0811310000
1090765200
5115611731
8627474000
3130000000
4910000000
8164400000
3503941720
1462808348
4208454000
3950000000
8027679421
7036255441
4585581571
7670070000
9795110000
1266019157
3405145934
5653643300
686...

result:

FAIL Expected integer, but "0605122330" found (/var/uoj_data/7492/6.out)

Test #7:

score: 0
Wrong Answer
time: 1821ms
memory: 172676kb

input:

1000000 1000000
893159 998545 986168 993381 985676 867284 972091 982736 955640 927289 966593 951563 991646 922075 897706 974374 991796 969579 986536 982837 960131 956828 884436 939569 947203 992954 987151 997095 975426 982625 957079 858678 895285 978500 993042 979758 967580 993571 985391 999717 9816...

output:

4139019884
2675921109
8638413805
4644008411
9982098595
1710010782
5760003162
8790967123
9842652364
5705500000
1581223189
8772767453
8900347243
1377829410
5570861392
4274896169
4354575455
3672615820
1986463469
4414781931
6989943384
1832588866
1581995187
7681732181
5259169851
6736175537
3909698763
639...

result:

FAIL Expected integer, but "0079812600" found (/var/uoj_data/7492/7.out)

Test #8:

score: 0
Wrong Answer
time: 1404ms
memory: 167184kb

input:

1000000 1000000
750898 600457 565525 577950 534158 368777 676282 361219 214512 889130 803951 106652 101780 257156 644752 39924 820954 979764 502497 269722 493893 282907 321990 932833 882749 377054 171786 391391 240717 884964 463001 46959 353829 972763 388101 436207 667673 24819 554628 775746 67680 9...

output:

6347408341
4878651000
7400714834
5174882000
3023362100
1474030000
2269230000
3028000000
4272146385
5540000000
3559213814
6510000000
3216601878
2681000000
7054300000
1186160522
2571697263
5736200000
9050462000
0073720000
2867207066
0247641012
8546000000
0379172000
6883210000
2300266951
8052685962
061...

result:

FAIL Expected integer, but "0073720000" found (/var/uoj_data/7492/8.out)