QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96324#6310. Dining Professorsxiafan8050WA 7ms3504kbC++20709b2023-04-13 19:34:542023-04-13 19:34:57

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 19:34:57]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3504kb
  • [2023-04-13 19:34:54]
  • 提交

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;
}

詳細信息

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'