QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#640806 | #6259. Gluttonous Goop | chanuuu# | WA | 1ms | 3824kb | C++17 | 1.5kb | 2024-10-14 16:10:13 | 2024-10-14 16:10:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
char mp[202][202];
const int dx[] = {-1,-1,-1,0,0,1,1,1}, dy[] = {-1,0,1,-1,1,-1,0,1};
struct st{
int x, y, d;
};
int main(){
cin.tie(nullptr)->sync_with_stdio(0);
int n,m,k, c = 0;
cin >> n >> m >> k;
queue<st> q;
memset(mp, '.', sizeof mp);
for (int i = 81; i <= n+80; i++){
for (int j = 81; j <= m+80; j++){
cin >> mp[i][j];
if (mp[i][j] == '#'){
c++;
q.push({j,i,0});
}
}
}
int bef = 0, aa = c;
vector<int> diff;
while (q.size() and q.front().d < 50){
int x,y,d;
x = q.front().x;
y = q.front().y;
d = q.front().d;
q.pop();
if (d != bef){
diff.push_back(c - aa);
cout << aa << ' ' << c << ' ' << diff.back() << endl;
bef = d;
aa = c;
}
if (d == k){
cout << c;
return 0;
}
for (int i = 0; i < 8; i++){
int nx = x + dx[i], ny = y + dy[i];
if (mp[ny][nx] != '#'){
mp[ny][nx] = '#';
c++;
q.push({nx, ny, d+1});
}
}
}
ll cha = diff.back() - diff[diff.size()-2];
// cout << c - aa << ' ' << cha <<endl;
// assert(c - aa - == cha)?;
ll ccc = k - 30;
cout << c + (c-aa)*ccc + (ccc+1)*ccc/2 * cha;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3824kb
input:
5 5 3 ..... .###. .#.#. .###. .....
output:
8 25 17 25 49 24 49 81 32 81
result:
wrong answer 1st lines differ - expected: '81', found: '8 25 17'