QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#640631#6259. Gluttonous Goopdohoon#WA 3ms7692kbC++171.2kb2024-10-14 14:53:262024-10-14 14:53:27

Judging History

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

  • [2024-10-14 14:53:27]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:7692kb
  • [2024-10-14 14:53:26]
  • 提交

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'