样例过不了为什么啊

P1886 滑动窗口 /【模板】单调队列

chenyitian @ 2021-03-07 16:49:11

先贴代码

#include <iostream>

using namespace std;

long long a[1000010];
long long maxa[1000010];
long long mina[1000010];

int main()
{
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i ++)
    {
        cin >> a[i];
    }
    for(int i = 1; i <= n - k + 1; i ++)
    {
        long long maxN = -2147483648, minN = 2147483648;
        for(int j = i; j <= i + k - 1; j ++)
        {
            if(a[j] > maxN)
            {
                maxN = a[j];
            }
            if(a[j] < minN)
            {
                minN = a[j];
            }
        }
        maxa[i] == maxN;
        mina[i] == minN;
    }
    for(int i = 1; i <= n - k + 1; i ++)
    {
        cout << mina[i] << " ";
    }
    cout << endl;
    for(int i = 1; i <= n - k + 1; i ++)
    {
        cout << maxa[i] << " ";
    }
    cout << endl;
}

哪里错了啊,全都是0


by EuphoricStar @ 2021-03-07 16:51:51

你这不是暴力吗……


by EuphoricStar @ 2021-03-07 16:52:17

        maxa[i] == maxN;
        mina[i] == minN;

by wlzhouzhuan @ 2021-03-07 16:53:49

爆 int 了


by chenyitian @ 2021-03-07 16:58:11


by eofitg @ 2021-06-05 15:55:45

??暴力能过吗


|