QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#460200#8781. Element-Wise Comparisonucup-team2307WA 0ms3652kbC++20869b2024-07-01 06:01:012024-07-01 06:01:02

Judging History

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

  • [2024-07-01 06:01:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3652kb
  • [2024-07-01 06:01:01]
  • 提交

answer

#pragma GCC optimize ("O3")
#pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;

const int N=5e4+100;

uint16_t p[N];
uint16_t cnt[N], ans[N];

void iter(uint16_t i, uint16_t lim, uint16_t m) {
    for (uint16_t d = 0; d <= lim; d++) {
        bool ok = p[i] < p[d + i];
        cnt[d] = (cnt[d] + 1) * ok;
        ans[d] += (cnt[d] >= m);
    }
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);

    uint16_t n,m;
    cin >> n >> m;

#if 0 // real use
    for (uint16_t i = 0; i < n; i++)
        cin >> p[i];
#else // random test
    for (uint16_t i = 0; i < n; i++)
        p[i] = i;
    mt19937 rng;
    shuffle(p, p + n, rng);
#endif

    for (uint16_t i = 0; i < n; i++)
        iter(i, min(n - m, n - i - 1), m);
    cout << accumulate(ans + 1, ans + n, 0LL);
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3652kb

input:

5 3
5 2 1 3 4

output:

0

result:

ok answer is '0'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3572kb

input:

5 2
3 1 4 2 5

output:

0

result:

wrong answer expected '2', found '0'