QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#669506 | #5118. Hotel | blue_sky | WA | 0ms | 3576kb | C++20 | 1.6kb | 2024-10-23 18:51:12 | 2024-10-23 18:51:12 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define bug(X) cout << "bug:# " << X << endl
#define bug2(f, X) cout << "bug:# " << f << " " << X << endl
#define bug3(i, j, G) cout << "bug:# " << i << ' ' << j << ' ' << G << endl
#define endl '\n'
using namespace std;
const int mod = 998244353;
const int N = 10 + 5e5;
void _();
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while (t--)
_();
return 0;
}
void _()
{
int n, x, y;
cin >> n >> x >> y;
int res = 0;
for (int i = 0; i < n; i++)
{
map<char, int> cnt;
string s;
cin >> s;
for (auto v : s)
cnt[v]++;
int t = min(3 * x, 3 * y);
if (cnt.size() < 3)
t = min(t, x + y);
res += t;
}
if (x * 2 >= y)
res = n * 3 * y;
cout << res << endl;
}
// void _()
// {
// int n, x, y;
// cin >> n >> x >> y;
// int res = 0;
// int f2 = 0, f1 = 0;
// for (int i = 0; i < n; i++)
// {
// map<char, int> cnt;
// string s;
// cin >> s;
// for (auto v : s)
// cnt[v] = 1;
// if (cnt.size() == 3)
// f1 += 3;
// else
// f1++, f2++;
// }
// res = min({f1 * x + f2 * y, x * n * 3, y * n * 3});
// for (int i = 0; i <= f2; i++)
// {
// int f11 = n * 3 - i * 2;
// res = min(res, f11 * x + i * y);
// }
// cout << res << endl;
// }
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3516kb
input:
3 1 3 MMM MMM FFF
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
3 3 1 ABC DEF GHI
output:
9
result:
ok 1 number(s): "9"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3576kb
input:
10 438 438 WWW SOU PUN ETC OME CFI NAL GOO DHO TEL
output:
13140
result:
wrong answer 1st numbers differ - expected: '12264', found: '13140'