QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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";
}
Details
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]; | ^~~~