QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96324 | #6310. Dining Professors | xiafan8050 | WA | 7ms | 3504kb | C++20 | 709b | 2023-04-13 19:34:54 | 2023-04-13 19:34:57 |
Judging History
answer
/**
* @author: XiaFan
* @date: 2023-04-13 19:21
*/
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, k;
std::cin >> n >> k;
std::vector<int> a(n);
for (int i = 0; i < n; i++) {
std::cin >> a[i];
}
int ans = n * 3;
int b[4] = {};
for (int i = 0; i < n; i++) {
int cnt = 0;
for (int j = i - 1; j <= i + 1; j++) {
cnt += !a[j % n];
}
b[cnt]++;
}
for (int i = 0; i <= 3; i++) {
int t = std::min(k, b[i]);
k -= t;
ans -= i * t;
}
std::cout << ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3424kb
input:
5 2 1 0 1 0 1
output:
13
result:
ok 1 number(s): "13"
Test #2:
score: -100
Wrong Answer
time: 7ms
memory: 3504kb
input:
100000 33292 1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0...
output:
279235
result:
wrong answer 1st numbers differ - expected: '279236', found: '279235'