QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#671864 | #6762. Hotpot | ACAAA# | WA | 11ms | 5596kb | C++23 | 861b | 2024-10-24 14:46:06 | 2024-10-24 14:46:07 |
Judging History
answer
#include <iostream>
#include <vector>
using namespace std;
const int N = 1e5 + 10;
int n, k, m,w[N],ans[N];
vector<int>a[N];
void solve() {
cin >> n >> k >> m;
for (int i = 0; i <=k; i++)
a[i].clear();
for (int i = 0; i <n; i++) {
cin >> w[i];
a[w[i]].push_back(i);
ans[i] = 0;
}
for (int i = 1; i <= k; i++) {
if (a[i].empty())continue;
else if (a[i].size()&1) {
for (int j = 0; j < a[i].size(); j++) {
int idx = a[i][j];
ans[idx] = m / n / 2 + ((m / n & 1) && (m % n > idx));
}
}
else {
for (int j = 1; j < a[i].size(); j += 2) {
int idx = a[i][j];
ans[idx] = m / n + ((m / n & 1) && (m % n >idx));
}
}
}
for (int i = 0; i < n; i++) {
cout << ans[i];
if (i != n - 1)
cout << " ";
}
cout << "\n";
}
int main() {
int t;
cin >> t;
while (t--)
solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3644kb
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
Wrong Answer
time: 11ms
memory: 5596kb
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:
72775249 72775249 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147055 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 147054 13...
result:
wrong answer 2nd lines differ - expected: '147055 147055 147055 147055 14...054 147055 147054 147055 147054', found: '147055 147055 147055 147055 14...054 147054 147054 147054 147054'