QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#418346 | #5118. Hotel | LLCS# | WA | 1ms | 3800kb | C++17 | 1.3kb | 2024-05-23 12:58:03 | 2024-05-23 12:58:07 |
Judging History
answer
/*
@Date : 2024-05-23 12:55:06
@Author : Adscn ([email protected])
@Link : http://www.cnblogs.com/LLCSBlog
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define IL inline
#define RG register
#define gi geti<int>()
#define gl geti<ll>()
#define gc getchar()
#define File(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
template<typename T>IL bool chkmax(T &x,const T &y){return x<y?x=y,1:0;}
template<typename T>IL bool chkmin(T &x,const T &y){return x>y?x=y,1:0;}
template<typename T>
IL T geti()
{
RG T xi=0;
RG char ch=gc;
bool f=0;
while(!isdigit(ch))ch=='-'?f=1:f,ch=gc;
while(isdigit(ch))xi=xi*10+ch-48,ch=gc;
return f?-xi:xi;
}
template<typename T>
IL void pi(T k,char ch=0)
{
if(k<0)k=-k,putchar('-');
if(k>=10)pi(k/10);
putchar(k%10+'0');
if(ch)putchar(ch);
}
/*
IL unsigned int LOG2(unsigned int x)
{
unsigned int ret;
__asm__ __volatile__ ("bsrl %1, %%eax":"=a"(ret):"m"(x));
return ret;
}
*/
int main(void)
{
#ifndef ONLINE_JUDGE
// File("");
#endif
ll n=gi,c1=gi,c2=gi;
ll ans=c1*n*3;
int cnt2=0;
for(int i=1;i<=n;++i){
char str[4];
scanf("%s",str);
if(str[0]==str[1]||str[0]==str[2]||str[1]==str[2])++cnt2;
}
chkmin(ans,cnt2*c2+(3*n-2*cnt2)*c1);
pi(ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3656kb
input:
3 1 3 MMM MMM FFF
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3800kb
input:
3 3 1 ABC DEF GHI
output:
27
result:
wrong answer 1st numbers differ - expected: '9', found: '27'