QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#577126#8781. Element-Wise ComparisonKangliyangWA 0ms3752kbC++14992b2024-09-20 08:18:092024-09-20 08:18:10

Judging History

This is the latest submission verdict.

  • [2024-09-20 08:18:10]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3752kb
  • [2024-09-20 08:18:09]
  • Submitted

answer

#include <bits/stdc++.h>
#define vector basic_string
#define pii array<int,2>
using namespace std;
typedef long long ll;
template<typename type>
inline void read(type &s){
	int f=1;s=0;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		s=s*10+(ch-'0');
		ch=getchar();
	}
	s*=f;
}
template<typename type,typename ...T>
inline void read(type &x,T&...y){read(x),read(y...);}
inline ll read(){
	ll x;
	read(x);
	return x;
}
bitset<50001>a[50001],tmp;
int n,m,p[50001];
ll ans;
int main(){
	n=read(),m=read();
	for(int i=1;i<=n;i++) p[read()]=i;
	for(int i=1;i<=m;i++){
		tmp.reset();
		for(int j=1;j<=n;j++){
			if(p[j]<i) continue;
			if(i==1) a[p[j]-i+1]=tmp;
			else a[p[j]-i+1]&=tmp;
			tmp.set(p[j]-i+1);
		}
	}
	// for(int i=1;i<=n;i++,puts(""))
		// for(int j=1;j<=n;j++) printf("%lld ",(int)a[i][j]);
	for(int i=1;i<=n-m+1;i++) ans+=a[i].count();
	printf("%lld\n",ans>>1);
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3740kb

input:

5 3
5 2 1 3 4

output:

0

result:

ok answer is '0'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3752kb

input:

5 2
3 1 4 2 5

output:

1

result:

wrong answer expected '2', found '1'