QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#640765#6259. Gluttonous Goopdohoon#WA 146ms5416kbC++171.3kb2024-10-14 15:52:532024-10-14 15:52:53

Judging History

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

  • [2024-10-14 15:52:53]
  • 评测
  • 测评结果:WA
  • 用时:146ms
  • 内存:5416kb
  • [2024-10-14 15:52:53]
  • 提交

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;
    
    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: 3640kb

input:

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

output:

81

result:

ok single line: '81'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

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

output:

19

result:

ok single line: '19'

Test #3:

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

input:

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

output:

96

result:

ok single line: '96'

Test #4:

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

input:

1 1 1000000
#

output:

4000004000001

result:

ok single line: '4000004000001'

Test #5:

score: 0
Accepted
time: 89ms
memory: 4896kb

input:

2 2 91011
.#
.#

output:

33132554552

result:

ok single line: '33132554552'

Test #6:

score: 0
Accepted
time: 146ms
memory: 5412kb

input:

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

output:

4000080000400

result:

ok single line: '4000080000400'

Test #7:

score: 0
Accepted
time: 124ms
memory: 5172kb

input:

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

output:

1588840081630

result:

ok single line: '1588840081630'

Test #8:

score: 0
Accepted
time: 138ms
memory: 5416kb

input:

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

output:

1588850165636

result:

ok single line: '1588850165636'

Test #9:

score: 0
Accepted
time: 143ms
memory: 5392kb

input:

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

output:

4000080000220

result:

ok single line: '4000080000220'

Test #10:

score: -100
Wrong Answer
time: 1ms
memory: 3656kb

input:

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

output:

3999596010200

result:

wrong answer 1st lines differ - expected: '0', found: '3999596010200'