QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#640631 | #6259. Gluttonous Goop | dohoon# | WA | 3ms | 7692kb | C++17 | 1.2kb | 2024-10-14 14:53:26 | 2024-10-14 14:53:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MXN = 2000;
using pii = pair<int,int>;
char A[MXN][MXN];
signed main() {
cin.tie(0)->sync_with_stdio(0);
int n, m, k; cin >> n >> m >> k;
vector<pii> Q;
for(int i=0;i<2000-1;i++){
for(int j=0;j<2000-1;j++) A[i][j] = '.';
}
for(int i=1000;i<1000+n;i++){
for(int j=1000;j<1000+m;j++){
cin >> A[i][j];
if(A[i][j]=='#')
Q.push_back({i,j});
}
}
for(int d=0;d<min(k,100LL);d++){
vector<pii> nq;
for(auto &[x,y] : Q) {
for(int dx=-1;dx<2;dx++) for(int dy=-1;dy<2;dy++){
int ax = x+dx, ay = y+dy;
if(A[ax][ay]=='.') {
A[ax][ay] = '#';
nq.push_back({ax,ay});
}
}
}
swap(Q,nq);
}
k = max(0LL,k-100);
int ans = 0;
for(int i=0;i<2000;i++) for(int j=0;j<2000;j++)
ans += (A[i][j]=='#');
if(k) {
int l = sqrt(ans);
l += k*2;
cout << l*l;
}
else {
cout << ans;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 7500kb
input:
5 5 3 ..... .###. .#.#. .###. .....
output:
81
result:
ok single line: '81'
Test #2:
score: 0
Accepted
time: 2ms
memory: 7476kb
input:
3 3 1 #.. .#. ..#
output:
19
result:
ok single line: '19'
Test #3:
score: 0
Accepted
time: 3ms
memory: 7636kb
input:
4 6 3 ..##.. .#..#. .#..#. ..##..
output:
96
result:
ok single line: '96'
Test #4:
score: 0
Accepted
time: 3ms
memory: 7560kb
input:
1 1 1000000 #
output:
4000004000001
result:
ok single line: '4000004000001'
Test #5:
score: -100
Wrong Answer
time: 3ms
memory: 7692kb
input:
2 2 91011 .# .#
output:
33132372529
result:
wrong answer 1st lines differ - expected: '33132554552', found: '33132372529'