QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#99862#6346. Record ParitycccgiftCompile Error//C++141.1kb2023-04-23 21:32:142023-04-23 21:32:17

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-23 21:32:17]
  • 评测
  • [2023-04-23 21:32:14]
  • 提交

answer

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
#define rep(i,l,r) for(int i=l,_=r;i<=_;++i)
#define per(i,r,l) for(int i=r,_=l;i>=_;--i)
#define Key_down(V) ((GetAsyncKeyState(V)&0x8000)?1:0)
#define iter(x,v) for(int _p=head[x],v;v=ver[_p],_p;_p=nxt[_p])
#define ll long long
#define lowbit(x) ((x)&-(x))
template<typename T>
inline void chkmin(T &x,T y) {x=x<y?x:y;}
template<typename T>
inline void chkmax(T &x,T y) {x=x>y?x:y;}
const int mod=998244353;
int n,k,a[1000010],f[1000010],Stack[1000010],top,fac[1000010],inv[1000010];
inline int kuai(int p,int q,int mod) {int tot=1;for(;q;p=(ll)p*p%mod,q>>=1) if(q&1) tot=(ll)tot*p%mod;return tot;}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>k,fac[0]=1;
	rep(i,1,n) fac[i]=(ll)fac[i-1]*i%mod;
	inv[n]=kuai(fac[n],mod-2,mod);
	per(i,n-1,0) inv[i]=(ll)inv[i+1]*(i+1)%mod;
	ll tot=0;
	rep(i,1,n) {
		cin>>a[i];
		while(top&&a[i]<=a[Stack[top]]) --top;
		Stack[++top]=i;
		if(top>=k) f[i]=(ll)fac[top-1]*inv[top-k]%mod;
	}
	rep(i,1,top) tot+=f[Stack[i]];
	tot%=mod,(tot*=inv[k-1])%=mod;
	if(k&1) tot=(mod-tot)%mod;
	cout<<tot<<'\n';
	cout<<flush;
	return 0;
}

详细

answer.code:2:9: fatal error: windows.h: No such file or directory
    2 | #include<windows.h>
      |         ^~~~~~~~~~~
compilation terminated.