QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#577126 | #8781. Element-Wise Comparison | Kangliyang | WA | 0ms | 3752kb | C++14 | 992b | 2024-09-20 08:18:09 | 2024-09-20 08:18:10 |
Judging History
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'