Submission #62041275


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<string> g(N);
for (int i = 0; i < N; i++)
{
cin >> g[i];
}
int minx = INT_MAX, maxx = INT_MIN, miny = INT_MAX, maxy = INT_MIN;
bool a = false;
for (int y = 0; y < N; y++)
{
for (int x = 0; x < M; x++)
{
if (g[y][x] == '#') {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<string> g(N);
    for (int i = 0; i < N; i++)
    {
        cin >> g[i];
    }
    
    int minx = INT_MAX, maxx = INT_MIN, miny = INT_MAX, maxy = INT_MIN;
    bool a = false;

    for (int y = 0; y < N; y++)
    {
        for (int x = 0; x < M; x++)
        {
            if (g[y][x] == '#') {
                minx = min(minx, x), maxx = max(maxx, x);
                miny = min(miny, y), maxy = max(maxy, y);
            }
            if (g[y][x] == '?') {
                a = true;
            }
        }
    }
    
    if (minx == INT_MAX) {
        cout << (a ? "Yes" : "No") << endl;
    } else {
        for (int y = miny; y <= maxy; y++)
        {
            for (int x = minx; x <= maxx; x++)
            {
                if (g[y][x] == '.') goto no;
            }
        }

        cout << "Yes" << endl;
        return 0;
        
        no:
        cout << "No" << endl;
    }
}

Submission Info

Submission Time
Task C - Paint to make a rectangle
User nitram_
Language C++ 23 (gcc 12.2)
Score 300
Code Size 1047 Byte
Status AC
Exec Time 16 ms
Memory 5576 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 41
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3564 KB
example_01.txt AC 1 ms 3468 KB
example_02.txt AC 1 ms 3488 KB
hand_00.txt AC 14 ms 5420 KB
hand_01.txt AC 13 ms 5376 KB
hand_02.txt AC 13 ms 5576 KB
hand_03.txt AC 13 ms 5456 KB
hand_04.txt AC 13 ms 5424 KB
hand_05.txt AC 1 ms 3472 KB
hand_06.txt AC 1 ms 3504 KB
hand_07.txt AC 1 ms 3504 KB
hand_08.txt AC 1 ms 3528 KB
hand_09.txt AC 15 ms 5392 KB
hand_10.txt AC 13 ms 5492 KB
hand_11.txt AC 14 ms 5448 KB
hand_12.txt AC 14 ms 5456 KB
random_00.txt AC 13 ms 4484 KB
random_01.txt AC 16 ms 5272 KB
random_02.txt AC 12 ms 4336 KB
random_03.txt AC 15 ms 4480 KB
random_04.txt AC 16 ms 5448 KB
random_05.txt AC 12 ms 4316 KB
random_06.txt AC 14 ms 5480 KB
random_07.txt AC 12 ms 5220 KB
random_08.txt AC 12 ms 4292 KB
random_09.txt AC 12 ms 4556 KB
random_10.txt AC 12 ms 4368 KB
random_11.txt AC 13 ms 5388 KB
random_12.txt AC 12 ms 5256 KB
random_13.txt AC 13 ms 5368 KB
random_14.txt AC 12 ms 4460 KB
random_15.txt AC 13 ms 5236 KB
random_16.txt AC 13 ms 4476 KB
random_17.txt AC 13 ms 5176 KB
random_18.txt AC 11 ms 4372 KB
random_19.txt AC 13 ms 4536 KB
random_20.txt AC 12 ms 4404 KB
random_21.txt AC 12 ms 4456 KB
random_22.txt AC 13 ms 4436 KB
random_23.txt AC 12 ms 4532 KB
random_24.txt AC 12 ms 4492 KB


2025-03-02 (Sun)
09:37:54 +00:00