Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: tHeNyXs

Problemset: A.Circle Area

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-15 09:12:47

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    cin >> n >> m;

    vector<string> c(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> c[i];
        c[i] = " " + c[i];
    }

    int top = -1, bottom = -1, center_i = -1, center_j = -1;

 
    for (int j = 1; j <= m; ++j) {
        int count = 0;
        for (int i = 1; i <= n; ++i) {
            if (c[i][j] == '#') {
                if (top == -1) top = i;
                bottom = i;
                count++;
            }
        }
        if (count >= 3) {
            center_j = j;
        }
    }

    if (top == -1 || bottom == -1 || center_j == -1) {
        cout << "No shape found\n";
        return 0;
    }

    center_i = (top + bottom) / 2;
    double diameter = (bottom - top + 1);
    double radius = diameter / 2.0;
    double area = 3.14 * radius * radius;

    cout << center_i << " " << center_j << '\n';
    cout << fixed << setprecision(2) << area << '\n';

    return 0;
}