QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#641020#6259. Gluttonous Goopdohoon#AC ✓139ms5476kbC++171.3kb2024-10-14 17:42:332024-10-14 17:42:33

Judging History

你现在查看的是最新测评结果

  • [2024-10-14 17:42:33]
  • 评测
  • 测评结果:AC
  • 用时:139ms
  • 内存:5476kb
  • [2024-10-14 17:42:33]
  • 提交

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});
        }
    }
    
    if (empty(s)) {
        cout << 0;
        return 0;
    }
    
    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;
    
    rep(i,-60,+80) {
        rep(j,-60,+80) {
            if (!s.count({i,j}))
            {
                bool flag = false;
                rep(x,-1,+1) rep(y,-1,+1) {
                    if (s.count({i+x,j+y})) {
                        flag = true;
                    }
                }
                if (flag)
                    around++;
            }
        }
    }
    
    rep(d,min(50ll,k)+1,k) {
        ans += around;
        around += 8;
    }
    
    cout << ans;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3604kb

input:

5 5 3
.....
.###.
.#.#.
.###.
.....

output:

81

result:

ok single line: '81'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3648kb

input:

3 3 1
#..
.#.
..#

output:

19

result:

ok single line: '19'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

4 6 3
..##..
.#..#.
.#..#.
..##..

output:

96

result:

ok single line: '96'

Test #4:

score: 0
Accepted
time: 84ms
memory: 4832kb

input:

1 1 1000000
#

output:

4000004000001

result:

ok single line: '4000004000001'

Test #5:

score: 0
Accepted
time: 81ms
memory: 4972kb

input:

2 2 91011
.#
.#

output:

33132554552

result:

ok single line: '33132554552'

Test #6:

score: 0
Accepted
time: 139ms
memory: 5476kb

input:

20 20 1000000
####################
####################
####################
####################
####################
####################
####################
####################
####################
####################
####################
####################
####################
#############...

output:

4000080000400

result:

ok single line: '4000080000400'

Test #7:

score: 0
Accepted
time: 117ms
memory: 5192kb

input:

20 20 630238
....................
....................
....................
....................
....................
....................
....................
....................
#...................
....................
....................
....................
....................
.................

output:

1588840081630

result:

ok single line: '1588840081630'

Test #8:

score: 0
Accepted
time: 131ms
memory: 5308kb

input:

20 20 630238
#...................
.#..................
..#.................
...#................
....#...............
.....#..............
......#.............
.......#............
........#...........
.........#..........
..........#.........
...........#........
............#.......
.............#...

output:

1588850165636

result:

ok single line: '1588850165636'

Test #9:

score: 0
Accepted
time: 132ms
memory: 5332kb

input:

20 20 1000000
.........##.........
........####........
.......######.......
......########......
.....##########.....
....############....
...##############...
..################..
.##################.
####################
####################
.##################.
..################..
...##########...

output:

4000080000220

result:

ok single line: '4000080000220'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

5 5 1000000
.....
.....
.....
.....
.....

output:

0

result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

5 5 1
.....
.....
.....
.....
.....

output:

0

result:

ok single line: '0'

Test #12:

score: 0
Accepted
time: 136ms
memory: 5424kb

input:

20 20 93002
####################
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#.................

output:

34604928576

result:

ok single line: '34604928576'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

20 20 3
####################
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#..................#
#.....................

output:

532

result:

ok single line: '532'

Test #14:

score: 0
Accepted
time: 109ms
memory: 5212kb

input:

10 12 173312
...#....##..
....#.#.....
............
##.#..#.....
...#...#..#.
#..##.....#.
#.##.#..#...
....#....#.#
.#.#..#.....
............

output:

120155476561

result:

ok single line: '120155476561'

Test #15:

score: 0
Accepted
time: 88ms
memory: 4952kb

input:

16 1 12123
.
.
#
.
.
.
#
.
.
.
.
.
.
.
.
.

output:

588013997

result:

ok single line: '588013997'

Test #16:

score: 0
Accepted
time: 123ms
memory: 5280kb

input:

20 11 78669
........#..
#..........
##...#.....
.##........
...........
.....#....#
....#......
#.##.......
.##...#.#..
...........
###.#......
...#...#...
.#.........
...........
..........#
.........##
..#...#....
....#.....#
##.........
....###.#..

output:

24760123916

result:

ok single line: '24760123916'

Test #17:

score: 0
Accepted
time: 105ms
memory: 5136kb

input:

3 20 935833
..#.#.....#...#.....
........#...........
.......#............

output:

3503163562228

result:

ok single line: '3503163562228'

Test #18:

score: 0
Accepted
time: 113ms
memory: 5196kb

input:

19 7 528014
.......
.....#.
#.#..#.
......#
.##...#
..#..#.
#..#...
.......
.#....#
.....#.
#......
#......
......#
..#....
...#.#.
.#..##.
....#.#
###..#.
...#...

output:

1115221537596

result:

ok single line: '1115221537596'

Test #19:

score: 0
Accepted
time: 117ms
memory: 5288kb

input:

15 15 139652
.............#.
...............
...............
...............
............#..
...............
.....#.........
.#........#...#
..#............
..##...........
...............
.#.............
.#.............
....#..........
...............

output:

78018544980

result:

ok single line: '78018544980'

Test #20:

score: 0
Accepted
time: 3ms
memory: 3824kb

input:

19 16 10
.#..............
.........#......
...#............
................
....#...#....#.#
.............#..
....#.........#.
.........#......
................
.....#..........
#..............#
......#.......#.
.......#........
........#....#..
.#......#.#.#...
#.........#.....
...#..........#.
.....

output:

1337

result:

ok single line: '1337'

Test #21:

score: 0
Accepted
time: 2ms
memory: 3612kb

input:

8 19 2
....#...........#..
....#.....##.......
.............#.....
#........###.......
............#......
........#.....#..#.
..#.....#..........
...................

output:

195

result:

ok single line: '195'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

15 1 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

output:

0

result:

ok single line: '0'

Test #23:

score: 0
Accepted
time: 2ms
memory: 3596kb

input:

18 9 1
.........
......#..
........#
.........
......#..
#........
...#.....
.#...#.##
......#..
........#
..#....#.
.........
.......#.
#........
.#......#
.........
.........
.........

output:

111

result:

ok single line: '111'

Test #24:

score: 0
Accepted
time: 2ms
memory: 3620kb

input:

19 13 4
.........#...
........#....
..........###
.......##...#
.........#...
.............
.............
..#..........
.............
.............
.............
.......#.....
.............
..#...#......
.............
.............
.....##......
.............
....#........

output:

374

result:

ok single line: '374'

Test #25:

score: 0
Accepted
time: 84ms
memory: 4836kb

input:

1 1 1000000
#

output:

4000004000001

result:

ok single line: '4000004000001'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

1 1 329048
.

output:

0

result:

ok single line: '0'

Test #27:

score: 0
Accepted
time: 130ms
memory: 5308kb

input:

20 20 12890
#..................#
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
..................

output:

665639639

result:

ok single line: '665639639'

Test #28:

score: 0
Accepted
time: 86ms
memory: 4908kb

input:

2 2 3901
.#
##

output:

60902415

result:

ok single line: '60902415'

Test #29:

score: 0
Accepted
time: 122ms
memory: 5332kb

input:

20 20 630238
#...................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
.................

output:

1588850165294

result:

ok single line: '1588850165294'

Test #30:

score: 0
Accepted
time: 107ms
memory: 5140kb

input:

20 20 630238
#..................#
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
.................

output:

1588826216592

result:

ok single line: '1588826216592'

Test #31:

score: 0
Accepted
time: 123ms
memory: 5352kb

input:

20 20 630238
...................#
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
.................

output:

1588850165294

result:

ok single line: '1588850165294'

Test #32:

score: 0
Accepted
time: 2ms
memory: 3656kb

input:

8 8 2
........
........
.....#..
...##...
...#....
........
........
........

output:

44

result:

ok single line: '44'

Test #33:

score: 0
Accepted
time: 2ms
memory: 3736kb

input:

20 20 0
####################
##.#################
#########..###.#####
#########.#####.####
##.######.#.##.#####
######.##.##.#######
#############.######
######.#######.#####
##########.###..####
#####.##.#####.#####
#############.######
#####.###.##.#######
####################
##.##.####.....####...

output:

357

result:

ok single line: '357'