QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#656882 | #5118. Hotel | wpoem | WA | 0ms | 3852kb | C++20 | 2.2kb | 2024-10-19 13:49:15 | 2024-10-19 13:49:16 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <stack>
#ifdef LOCAL
template <class T, size_t size = std::tuple_size<T>::value> std::string to_debug(T, std::string s = "") requires(not std::ranges::range<T>);
std::string to_debug(auto x) requires requires(std::ostream& os) { os << x; } { return static_cast<std::ostringstream>(std::ostringstream() << x).str(); }
std::string to_debug(std::ranges::range auto x, std::string s = "") requires(not std::is_same_v<decltype(x), std::string>) {
for (auto xi : x) { s += ", " + to_debug(xi); }
return "[" + s.substr(s.empty() ? 0 : 2) + "]";
}
template <class T, size_t size> std::string to_debug(T x, std::string s) requires(not std::ranges::range<T>) {
[&]<size_t... I>(std::index_sequence<I...>) { ((s += ", " + to_debug(get<I>(x))), ...); }(std::make_index_sequence<size>());
return "(" + s.substr(s.empty() ? 0 : 2) + ")";
}
#define debug(...) std::cerr << __LINE__ << ": (" #__VA_ARGS__ ") = " << to_debug(std::tuple(__VA_ARGS__)) << "\n"
#else
#define debug(x...)
#endif
using i64 = long long;
void solve()
{
int ans{};
int n, c1, c2;
std::string team;
std::cin >> n >> c1 >> c2;
for(int i = 1 ; i <= n ; i++){
std::cin >> team;
std::set <char> gen;
for(auto& g : team){
gen.insert(g);
}
int sum{std::numeric_limits<int>::max()};
sum = std::min(c1 * 3, c2 * 3);
sum = std::min(c1 * 2 + c2, sum);
sum = std::min(c1 + c2 * 2, sum);
if(gen.size() < 3){
sum = std::min(sum, c1 + c2);
}
ans += sum;
}
std::cout << ans;
}
signed main()
{
std::cin.tie(nullptr)->sync_with_stdio(false);
int _{1};
#ifdef tests
std::cin >> _;
#endif
while(_--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3776kb
input:
3 1 3 MMM MMM FFF
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
3 3 1 ABC DEF GHI
output:
9
result:
ok 1 number(s): "9"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
10 438 438 WWW SOU PUN ETC OME CFI NAL GOO DHO TEL
output:
12264
result:
ok 1 number(s): "12264"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3 2 3 MMM MMM MMM
output:
15
result:
ok 1 number(s): "15"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
1 240 45 CAB
output:
135
result:
ok 1 number(s): "135"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
1 140 846 ACB
output:
420
result:
ok 1 number(s): "420"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
2 488 849 CAC DCD
output:
2674
result:
ok 1 number(s): "2674"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
2 49 987 BAB AAB
output:
294
result:
ok 1 number(s): "294"
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3552kb
input:
100 695 531 BCA ADA CBD CFB EAF BAE HCI ECE CII BBB AAC ACC AEC BCC DAC DCF HDC DGF IDB ABB ACB ABB BCD ABC CBD GGD EGC CJF JIC ABB BCC CDA DBD FAF DAC CFG HGF CGH AJD ABA CCC ACC CBC FEE GGG DDF BFD EFB GDK ABB CBB ADB DBD CFE ECC AHC IAA CAH DJE ABB BCC AAD EDB BAE ECE CCH HGC CAJ IJD ABB ACC CAC ...
output:
140583
result:
wrong answer 1st numbers differ - expected: '132219', found: '140583'