QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#377562#8278. Secret PoemsPetroTarnavskyi#WA 0ms3540kbC++201.0kb2024-04-05 15:16:562024-04-05 15:16:58

Judging History

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

  • [2024-04-05 15:16:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3540kb
  • [2024-04-05 15:16:56]
  • 提交

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;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int m, n, x;
	cin >> m >> n >> x;
	VI a(n);
	FOR (i, 0, n) cin >> a[i];
	sort(ALL(a));
	multiset<PII> s;
	if (x == 0)
	{
		cout << m << " 0\n";
		return 0; 
	}
	FOR (i, 0, n)
	{
		s.insert({a[i], a[i]});
		m--;
		if (m == 0) break;
	}
	while (!s.empty())
	{
		auto p = *s.begin();
		if (p.F > x) break;
		
		s.erase(s.begin());
		if (m)
		{
			s.insert({p.F + p.S, p.S});
			m--;
		}
	}
	int ans = 0;
	for (auto p : s)
	{
		if (p.F - p.S != x) ans++;
		else
			m++;
	}
	cout << m << ' ' << ans << '\n';
	
	return 0;	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
THSAD
IIVOP
SEOOH
RGETI
YMINK

output:

5 0

result:

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