QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#64521#3083. Bit OperationTenshiRE 0ms0kbC++17903b2022-11-24 22:56:592022-11-24 22:57:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-24 22:57:01]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2022-11-24 22:56:59]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()
#define ma 350005
#define mo 998244353
#define x first
#define y second
using pii = pair<int, int>;
using ll = long long;
 
inline void read(int &x){
    int s=0; x=1;
    char ch=getchar();
    while(ch<'0' || ch>'9') {if(ch=='-')x=-1;ch=getchar();}
    while(ch>='0' && ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
    x*=s;
}
int a[ma],p[ma],ct[ma];
signed main(){
	int n,m,an=1,t1=0,t2=0;read(n);read(m);
	for(int i=1;i<=m;i++)
	{
		read(a[i]);p[a[i]]=1;
		if(i==m)ct[a[i]]++;
		ct[max(a[i],a[i-1])]++;
	}
	for(int i=1;i<=n;i++)if(p[i])t1+=ct[i];else an=an*(t1+t2)%mo,t2++;
	cout<<an;return 0;
}

详细

Test #1:

score: 0
Runtime Error

input:

999993
1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 1 1 1 1 0 1 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 1 1 1 1 0 1 1 0 0 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0 0 0 1 1...

output:


result: