QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#671849#6762. HotpotACAAA#WA 11ms5664kbC++23811b2024-10-24 14:43:152024-10-24 14:43:17

Judging History

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

  • [2024-10-24 14:43:17]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:5664kb
  • [2024-10-24 14:43:15]
  • 提交

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) {
			int idx = a[i][0];
			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();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3560kb

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
0 0 294110 0 294110 294110 0 294110 0 0 294110 0 294110 294110 0 294110 0 294109 0 0 294109 0 294109 0 294109 0 294109 0 294109 0 294109 0 294109 294109 0 0 294109 0 294109 0
0 0 0 26943824 0 0 13471912 13471912 13471912 0 0 26943824 26943824 0 26943824 26943824 0 0 26943824 0 2694...

result:

wrong answer 2nd lines differ - expected: '147055 147055 147055 147055 14...054 147055 147054 147055 147054', found: '0 0 294110 0 294110 294110 0 2...09 294109 0 0 294109 0 294109 0'