QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#100857 | #5114. Cells Coloring | lgvc# | WA | 3ms | 3556kb | C++23 | 1.7kb | 2023-04-28 14:06:24 | 2023-04-28 14:06:29 |
Judging History
answer
//这回只花了114514min就打完了。
//真好。记得多手造几组。
#include <bits/stdc++.h>
#define int long long
#define pai 3.141592653589793238462643383279502884197169399375105820
#define MOD 1000000007
#define eps 0.00000001
inline int min(int a,int b) {return a<b?a:b;}
inline int max(int a,int b) {return a>b?a:b;}
#define ULL unsigned long long
#define LL long long
#define INF 0x3f3f3f3f
#define INF_LL 0x3f3f3f3f3f3f3f3f
static char buf[1000000],*paa=buf,*pd=buf;
static char buf2[1000000],*pp=buf2;
#define getchar() paa==pd&&(pd=(paa=buf)+fread(buf,1,1000000,stdin),paa==pd)?EOF:*paa++
inline void pc(char ch){
if(pp-buf2==1000000) fwrite(buf2,1,1000000,stdout),pp=buf2;
*pp++=ch;
}
inline void pcc(){
fwrite(buf2,1,pp-buf2,stdout);
pp=buf2;
}
inline int read(void) {
int w=1;
register int x(0);register char c(getchar());
while(c<'0'||c>'9') {if(c=='-') w=-1;c=getchar();}
while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return w*x;
}
void write(int x) {
if(x<0) pc('-'),x=-x;
static int sta[20];
int top=0;
do {
sta[top++]=x%10,x/=10;
} while(x);
while(top) pc(sta[--top]+48);
}
void we(int x) {
write(x);
pc('\n');
}
inline bool cmp_xi(int a,int b) {return a<b;}
inline bool cmp_da(int a,int b) {return a>b;}
int N,M,C,D,aq,v[2];
char s[259][259];
signed main(void) {
//freopen("m.in","r",stdin);
//freopen("m.out","w",stdout);
scanf("%lld %lld %lld %lld",&N,&M,&C,&D);
for(int i=1;i<=N;i++) {
scanf("%s",s[i]+1);
for(int j=1;j<=M;j++) {
if(s[i][j]=='.') aq++,v[(i^j)&1]++;
}
}
int ans=std::min(2*C,aq*D);
printf("%lld",std::min(ans,C+std::min(v[0],v[1])*D));
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
input:
3 4 2 1 .*** *..* **..
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
3 4 1 2 .*** *..* **..
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: -100
Wrong Answer
time: 3ms
memory: 3540kb
input:
250 250 965680874 9042302 ..**.*****..**..**.*****..***..***.**......*.***.*...***.*....*.**.*.**.*.*.****...*.******.***.************....**.*..*..***.*******.*.***.*..**..****.**.*.*..***.****..**.....***.....*.****...*...*.***..****..**.*.*******..*.*******.*.*.*.****.*.*** ....**.*******.*.******...
output:
1931361748
result:
wrong answer 1st numbers differ - expected: '109972100048', found: '1931361748'