QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#64521 | #3083. Bit Operation | Tenshi | RE | 0ms | 0kb | C++17 | 903b | 2022-11-24 22:56:59 | 2022-11-24 22:57:01 |
Judging History
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...