QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#640778 | #6259. Gluttonous Goop | dohoon# | RE | 143ms | 5504kb | C++17 | 1.4kb | 2024-10-14 15:59:42 | 2024-10-14 15:59:42 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,a,b) for (ll i = (a); i <= (b); ++i)
#define per(i,a,b) for (ll i = (b); i >= (a); --i)
#define all(x) begin(x),end(x)
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using ii = pair<ll,ll>;
set<ii> s, t;
signed main() {
cin.tie(0)->sync_with_stdio(0);
ll n, m, k;
cin >> n >> m >> k;
rep(i,1,n) rep(j,1,m) {
char c; cin >> c;
if (c == '#') {
s.insert({i,j});
}
}
rep(d,1,min(50ll,k)) {
for (auto [x,y] : s) {
rep(i,-1,+1) rep(j,-1,+1)
t.insert({x+i,y+j});
}
swap(s,t);
}
ll ans = size(s);
ll around = 0;
ll add = 0;
rep(i,-60,+80) {
rep(j,-60,+80) {
if (!s.count({i,j}))
{
ll flag = 0;
rep(x,-1,+1) rep(y,-1,+1) {
if (s.count({i+x,j+y})) {
flag++;
}
}
if (flag) {
around++;
if (flag==2) add++;
assert(flag<=3);
}
}
}
}
rep(d,min(50ll,k)+1,k) {
ans += around;
around += add;
}
cout << ans;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3736kb
input:
5 5 3 ..... .###. .#.#. .###. .....
output:
81
result:
ok single line: '81'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3680kb
input:
3 3 1 #.. .#. ..#
output:
19
result:
ok single line: '19'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
4 6 3 ..##.. .#..#. .#..#. ..##..
output:
96
result:
ok single line: '96'
Test #4:
score: 0
Accepted
time: 88ms
memory: 4888kb
input:
1 1 1000000 #
output:
4000004000001
result:
ok single line: '4000004000001'
Test #5:
score: 0
Accepted
time: 89ms
memory: 4924kb
input:
2 2 91011 .# .#
output:
33132554552
result:
ok single line: '33132554552'
Test #6:
score: 0
Accepted
time: 143ms
memory: 5504kb
input:
20 20 1000000 #################### #################### #################### #################### #################### #################### #################### #################### #################### #################### #################### #################### #################### #############...
output:
4000080000400
result:
ok single line: '4000080000400'
Test #7:
score: -100
Runtime Error
input:
20 20 630238 .................... .................... .................... .................... .................... .................... .................... .................... #................... .................... .................... .................... .................... .................