QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#460200 | #8781. Element-Wise Comparison | ucup-team2307 | WA | 0ms | 3652kb | C++20 | 869b | 2024-07-01 06:01:01 | 2024-07-01 06:01:02 |
Judging History
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'