QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#322293#6762. HotpotYarema#WA 0ms3536kbC++141.1kb2024-02-06 19:36:492024-02-06 19:36:50

Judging History

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

  • [2024-02-06 19:36:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3536kb
  • [2024-02-06 19:36:49]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

const int N =  100'447;
int cnt[N];

void solve()
{
	int n, k, m;
	cin >> n >> k >> m;
	VI a(n), pos(n);
	FOR (i, 0, n)
	{
		cin >> a[i];
		a[i]--;
		pos[i] = cnt[a[i]];
		cnt[a[i]]++;
	}
	int cycl = m / n;
	VI ans(n);
	FOR (i, 0, n)
	{
		if (cnt[a[i]] & 1)
			ans[i] = cycl / 2;
		else if (pos[i] & 1)
			ans[i] = cycl / 2 * 2;
	}
	set<int> s;
	m -= cycl / 2 * 2 * n;
	FOR (i, 0, m)
	{
		int j = i % n;
		if (s.count(a[j]))
		{
			ans[j]++;
			s.erase(a[j]);
		}
		else
			s.insert(a[j]);
	}
	FOR (i, 0, k)
	{
		cnt[i] = 0;
	}
	FOR (i, 0, n)
		cout << ans[i] << ' ';
	cout << '\n';
}

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



詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3536kb

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:

wrong answer 1st lines differ - expected: '0 2 1', found: '0 2 1 '