QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#295204#7872. 崩坏天际线zhouhuanyi0 2ms5680kbC++201.2kb2023-12-30 20:58:432023-12-30 20:58:43

Judging History

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

  • [2023-12-30 20:58:43]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:5680kb
  • [2023-12-30 20:58:43]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#define N 100000
#define mod 998244353
using namespace std;
const int inv2=(mod+1)>>1;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
void Adder(int &x,int d)
{
	x+=d;
	if (x>=mod) x-=mod;
	return;
}
struct reads
{
	int l,r,d;
};
reads tong[N+1];
int n,q,length,ans,invpw[N+1],op[N+1],l[N+1],r[N+1],x[N+1];
int main()
{
	invpw[0]=1;
	for (int i=1;i<=N;++i) invpw[i]=1ll*invpw[i-1]*inv2%mod;
	n=read(),q=read();
	for (int i=1;i<=q;++i)
	{
		op[i]=read();
		if (op[i]==1) l[i]=read(),r[i]=read();
		else x[i]=read();
	}
	for (int i=1;i<=q;++i)
		if (op[i]==1)
		{
			tong[length=1]=(reads){l[i],r[i],0};
			for (int j=i+1;j<=q;++j)
				if (op[j]==2)
				{
					for (int k=1;k<=length;++k)
						if (tong[k].l<x[j]&&x[j]<tong[k].r)
						{
							tong[k].r=x[j],tong[k].d++,tong[++length]=(reads){x[i],tong[k].r,tong[k].d+1};
							break;
						}
				}
			for (int j=1;j<=length;++j) Adder(ans,1ll*(tong[j].r-tong[j].l)*invpw[tong[j].d]%mod);
		}
	printf("%d\n",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 5680kb

input:

500 500
1 119 258
2 134
2 417
2 176
2 61
2 60
2 110
1 335 336
1 96 111
2 202
1 138 344
2 358
2 134
1 29 54
1 73 381
1 179 495
2 490
2 418
2 186
2 183
1 168 340
2 78
1 15 27
2 373
1 245 498
1 372 495
2 244
2 63
1 174 490
2 282
2 417
1 272 408
1 109 134
2 303
2 345
1 238 401
1 36 480
1 21 483
2 10
1 3...

output:

27041323

result:

wrong answer 1st lines differ - expected: '855279801', found: '27041323'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Time Limit Exceeded

Test #13:

score: 0
Time Limit Exceeded

input:

50000 50000
1 24367 33007
1 14396 42256
1 6375 22327
1 7892 42501
1 10100 37998
1 6284 48524
1 7357 18164
1 16200 46424
1 18972 34131
1 16849 32591
1 1917 3018
1 19897 30272
1 45044 45753
1 18999 25448
1 5167 31033
1 6182 35335
1 7270 37270
1 12651 39965
1 28896 38022
1 13853 35426
1 35516 48244
1 1...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

0%