QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#644161 | #8781. Element-Wise Comparison | zhao_daodao | Compile Error | / | / | C++14 | 577b | 2024-10-16 11:27:10 | 2024-10-16 11:27:12 |
Judging History
answer
#include<bits/stdc++.h>
#define int short
using namespace std;
const int MAXN=5e4+5;
int n,m,a[MAXN];
int can[MAXN],ans[MAXN];
inline void check(int i,int mx){
for(int len=1;len<=mx;len++){
if(a[i]<a[i+len])can[len]++;
else can[len]=0;
ans[len]+=(can[len]>=m);
}
}
signed main(){
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
cin>>n>>m;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=n;i++)check(i,min(n-m,n-i+1));
int res=0;
for(int i=1;i<=n;i++)res+=ans[i];
cout<<res<<"\n";
}
詳細信息
answer.code:4:19: warning: overflow in conversion from ‘double’ to ‘short int’ changes value from ‘5.0005e+4’ to ‘32767’ [-Woverflow] 4 | const int MAXN=5e4+5; | ~~~^~ answer.code:5:11: error: size of array ‘a’ exceeds maximum object size ‘9223372036854775807’ 5 | int n,m,a[MAXN]; | ^~~~ answer.code:6:9: error: size of array ‘can’ exceeds maximum object size ‘9223372036854775807’ 6 | int can[MAXN],ans[MAXN]; | ^~~~ answer.code:6:19: error: size of array ‘ans’ exceeds maximum object size ‘9223372036854775807’ 6 | int can[MAXN],ans[MAXN]; | ^~~~