QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#189401#6762. Hotpotucup-team004RE 1ms3468kbC++20916b2023-09-27 14:17:132023-09-27 14:17:13

Judging History

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

  • [2023-09-27 14:17:13]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3468kb
  • [2023-09-27 14:17:13]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

void solve() {
    int n, k, m;
    std::cin >> n >> k >> m;
    
    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        a[i]--;
    }
    
    std::vector<int> have(k), happy(n);
    for (int i = 0; i < 2 * n; i++) {
        int x = i % n;
        happy[x] += have[a[x]];
        have[a[x]] ^= 1;
    }
    for (int i = 0; i < n; i++) {
        happy[i] *= m / (2 * n);
    }
    for (int i = 0; i < m % (2 * n); i++) {
        int x = i % n;
        happy[i] += have[a[x]];
        have[a[x]] ^= 1;
    }
    for (int i = 0; i < n; i++) {
        std::cout << happy[i] << " \n"[i == n - 1];
    }
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3468kb

input:

4
3 2 6
1 1 2
1 1 5
1
2 2 10
1 2
2 2 10
1 1

output:

0 2 1
2
2 2
0 5

result:

ok 4 lines

Test #2:

score: -100
Runtime Error

input:

1000
2 73 291100997
46 23
40 2 11764377
1 2 2 2 1 2 2 2 1 2 2 2 2 1 1 1 2 2 2 1 2 2 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 2 1 1
29 20 781370886
4 9 7 4 10 4 1 6 19 15 20 9 20 18 7 4 7 13 18 4 13 13 10 15 15 9 20 5 3
53 95 911403367
44 41 65 63 37 8 15 9 47 83 44 91 23 89 59 60 5 19 77 24 73 35 30 79 1 94 92...

output:


result: