QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#377562 | #8278. Secret Poems | PetroTarnavskyi# | WA | 0ms | 3540kb | C++20 | 1.0kb | 2024-04-05 15:16:56 | 2024-04-05 15:16:58 |
Judging History
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'