QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#460195 | #8781. Element-Wise Comparison | ucup-team2307 | WA | 0ms | 3704kb | C++20 | 860b | 2024-07-01 05:57:01 | 2024-07-01 05:57:02 |
Judging History
answer
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
using namespace std;
const int N=5e4+100;
int32_t p[N];
int32_t cnt[N],ans[N];
void iter(int32_t i, int32_t lim, int32_t m) {
int32_t d = 1;
for (; 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);
int32_t n,m;
cin >> n >> m;
#if 0 // real use
for (int32_t i = 0; i < n; i++)
cin >> p[i];
#else // random test
for (int32_t i = 0; i < n; i++)
p[i] = i;
mt19937 rng;
shuffle(p, p + n, rng);
#endif
for (int32_t i = 0; i < n; i++)
iter(i, min(n - m, n - i - 1), m);
cout << accumulate(ans, ans + n, 0LL);
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3704kb
input:
5 3 5 2 1 3 4
output:
0
result:
ok answer is '0'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3684kb
input:
5 2 3 1 4 2 5
output:
0
result:
wrong answer expected '2', found '0'