QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#417747 | #5114. Cells Coloring | ganking | WA | 2ms | 3628kb | C++20 | 1.4kb | 2024-05-22 21:36:42 | 2024-05-22 21:36:42 |
Judging History
answer
#include<bits/stdc++.h>
#define fo(i,a,b) for (int (i)=(a);(i)<=(b);(i)++)
#define fd(i,b,a) for (int (i)=(b);(i)>=(a);(i)--)
#define mk(x,y) make_pair((x),(y))
#define ll long long
using namespace std;
const int N = 1e6 + 100;
int n, m, c, d;
char a[260][260];
int x[260], y[260];
int main() {
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n, m, c, d;
cin >> n >> m >> c >> d;
for (int i = 0;i < n;i++)
{
for (int j = 0;j < m;j++)
{
cin >> a[i][j];
if (a[i][j] == '.')
{
x[i]++;
y[j]++;
}
}
}
ll ans, tmp;
ll answer = 1e18;
for (int i = 0;i <= max(n, m);i++)
{
ans = 0;
tmp = i * c;
for (int j = 0;j < n;j++)
{
//cout << x[j] << " ";
tmp += max(0, x[j] - i) * d;
}
//cout << tmp << '\n';
ans = max(ans, tmp);
tmp = i * c;
for (int j = 0;j < m;j++)
{
tmp += max(0, y[j] - i) * d;
//cout << y[j] << " ";
}
//cout << tmp << '\n';
ans = max(ans, tmp);
answer = min(answer, ans);
}
cout << answer;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3556kb
input:
3 4 2 1 .*** *..* **..
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
3 4 1 2 .*** *..* **..
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: -100
Wrong Answer
time: 2ms
memory: 3508kb
input:
250 250 965680874 9042302 ..**.*****..**..**.*****..***..***.**......*.***.*...***.*....*.**.*.**.*.*.****...*.******.***.************....**.*..*..***.*******.*.***.*..**..****.**.*.*..***.****..**.....***.....*.****...*...*.***..****..**.*.*******..*.*******.*.*.*.****.*.*** ....**.*******.*.******...
output:
0
result:
wrong answer 1st numbers differ - expected: '109972100048', found: '0'