QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#296193#6310. Dining ProfessorsSaladDays#WA 6ms4604kbC++14756b2024-01-02 13:47:442024-01-02 13:47:44

Judging History

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

  • [2024-01-02 13:47:44]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:4604kb
  • [2024-01-02 13:47:44]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int>a(n);
    for(int i = 0; i < n; ++i) cin >> a[i];
    vector<int>b(n), key(n), c(n, 0);
    long long ans = 3 * n;
    for (int i = 0; i < n; ++i) {
        b[i] = a[i] + a[(i + 1) % n] + a[(i + n - 1) % n];
    }
    iota(key.begin(), key.end(), 0);
    sort(key.begin(), key.end(), [&](int x, int y){
        return b[x] > b[y];
    });
    for (int i = 0; i < k; ++i) ans -= 3 - b[i];
    cout << ans << endl;
}

int main() {
#ifdef DEBUG
    freopen("demo.in", "r", stdin);
    freopen("demo.out", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    solve();

    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3592kb

input:

5 2
1 0 1 0 1

output:

13

result:

ok 1 number(s): "13"

Test #2:

score: -100
Wrong Answer
time: 6ms
memory: 4604kb

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:

250073

result:

wrong answer 1st numbers differ - expected: '279236', found: '250073'