QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#775613 | #9790. Make Swamp Great Again | ucup-team3215# | WA | 1ms | 3704kb | C++23 | 529b | 2024-11-23 16:19:20 | 2024-11-23 16:19:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e5 + 1;
int cnt[N], spawn[N], a[N + 1];
int main() {
cin.tie(0)->sync_with_stdio(0);
int n; cin >> n;
for (int i = 0; i < n; ++i) cin >> a[i], ++cnt[a[i]];
a[n] = a[0], a[n + 1] = a[1];
for (int i = 0; i < n; ++i) {
spawn[min({a[i], a[i + 1], a[i + 2]})] = 1;
spawn[max({a[i], a[i + 1], a[i + 2]})] = 1;
}
int ans = N;
for (int i = 1; i < N; ++i) ans = min(ans, n - cnt[i] + 1 - spawn[i]);
cout << ans << '\n';
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3704kb
input:
6 4 7 47 4 77 47
output:
4
result:
wrong answer 1st lines differ - expected: '4 6 4 4 5 4', found: '4'