QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#594164#8781. Element-Wise ComparisonmaxiaomengWA 1ms5708kbC++14606b2024-09-27 19:50:162024-09-27 19:50:17

Judging History

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

  • [2024-09-27 19:50:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5708kb
  • [2024-09-27 19:50:16]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
const int N=50005;
int n,m,a[N],r;
bitset<N> f[N],g[N],k,l;
int z[N];
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i],z[a[i]]=i;
	for(int i=n;i;--i){
		f[z[i]]=l<<z[i];
		l.set(z[i]);
	}
	for(int i=m;i<=n;i+=m){
		k.set();
		for(int j=1;j<=m;j++){
			k&=f[i-j+1];
			g[i-j+1]=k;
		}
		k.set();
		for(int j=1;j<=m&&i+j-1<=n;j++){
			k&=f[i+j-1];
			r+=(k&g[i-(m-j+1)+1]).count();
		}
	}
	cout<<r;
    return 0;
}


详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5648kb

input:

5 3
5 2 1 3 4

output:

0

result:

ok answer is '0'

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 5708kb

input:

5 2
3 1 4 2 5

output:

1

result:

wrong answer expected '2', found '1'