QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#644161#8781. Element-Wise Comparisonzhao_daodaoCompile Error//C++14577b2024-10-16 11:27:102024-10-16 11:27:12

Judging History

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

  • [2024-10-16 11:27:12]
  • 评测
  • [2024-10-16 11:27:10]
  • 提交

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];
      |                   ^~~~