QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#64523 | #3090. Inverse Problem | Tenshi | WA | 2ms | 3308kb | C++17 | 903b | 2022-11-24 22:57:51 | 2022-11-24 22:57:53 |
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
Wrong Answer
time: 2ms
memory: 3308kb
input:
7 2 2 1
output:
2520
result:
wrong answer 1st lines differ - expected: '720', found: '2520'