QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#395427#3090. Inverse ProblemSamponYWWA 1ms5716kbC++141.4kb2024-04-21 14:27:482024-04-21 14:27:48

Judging History

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

  • [2024-04-21 14:27:48]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5716kb
  • [2024-04-21 14:27:48]
  • 提交

answer

#include <bits/stdc++.h>
#define db double
#define il inline
#define re register
#define ll long long
#define ui unsigned
#define ull ui ll
#define i128 __int128
#define pii pair<int, int>
#define fi first
#define se second
#define eb emplace_back
#define SZ(v) (int)v.size()
#define ALL(v) v.begin(), v.end()
#define mems(v, x) memset(v, x, sizeof(v))
#define memc(a, b) memcpy(a, b, sizeof(a))
#define FOR(i, L, R) for(re int i = (L); i <= (R); ++i)
#define ROF(i, R, L) for(re int i = (R); i >= (L); --i)
#define LS i << 1, l, mid
#define RS i << 1 | 1, mid + 1, r
#define popc(x) __builtin_popcount(x)
using namespace std;
using poly = vector<int> ;
using Fp = pair<poly, poly> ;
#define N (1 << 20)
#define P 998244353
il int add(int x, int y) {return x + y < P ? x + y : x + y - P;}
il void addr(int &x, int y) {(x += y) >= P && (x -= P);}
il int qpow(int p, int n = P - 2) {
  int s = 1;
  while(n) {
    if(n & 1) s = 1ll * s * p % P;
    p = 1ll * p * p % P, n >>= 1;
  }
  return s;
}
int n, m, a[N]; bool u[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> n >> m;
  FOR(i, 1, m) cin >> a[i], u[a[i]] = 1;
  FOR(i, 1, m - 1) if(a[i] > a[i + 1]) {cout << 0; return 0;}
  int cnt = 0, ans = 1;
  FOR(i, 1, n) {
    if(u[i]) {++cnt, --m; if(!m) ++cnt; continue;}
    ans = 1ll * ans * cnt % P, ++cnt;
  }
  cout << ans;
  cerr << 1.0 * clock() / CLOCKS_PER_SEC;
  return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5716kb

input:

7 2
2 1

output:

0

result:

wrong answer 1st lines differ - expected: '720', found: '0'