Submission #62040460
Source Code Expand
Copy
#include<bits/stdc++.h>using namespace std;using ll = long long;using ld = long double;using pi = pair<int, int>;using pll = pair<ll, ll>;const int INF = 1e9 + 5;const ll llINF = 1e18;const int SZ = 1 << 18;const int mxn = 1005;int H, W;int M[mxn][mxn];// 0: white, 1: black, -1 : unknown// -1 인 곳에 검정색 or 흰색을 칠할건데// 검정색은 완벽한 네모를 만들어야하고 나머지는 모두 화이트로 칠할거임// 가능?
#include<bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pi = pair<int, int>; using pll = pair<ll, ll>; const int INF = 1e9 + 5; const ll llINF = 1e18; const int SZ = 1 << 18; const int mxn = 1005; int H, W; int M[mxn][mxn]; // 0: white, 1: black, -1 : unknown // -1 인 곳에 검정색 or 흰색을 칠할건데 // 검정색은 완벽한 네모를 만들어야하고 나머지는 모두 화이트로 칠할거임 // 가능? // 기존에 있던 검정색 자체는 모두 포함해야 함 int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); // 좌표 int ly, lx, ry, rx; ly = lx = INF; ry = rx = -INF; cin >> H >> W; for(int i = 0; i < H; i++) { string x; cin >> x; for(int j = 0; j < W; j++) { if(x[j] == '#') { M[i][j] = 1; ly = min(ly, i); lx = min(lx, j); ry = max(ry, i); rx = max(rx, j); } else if(x[j] == '.') { M[i][j] = 0; } else { M[i][j] = -1; } } } for(int i = ly; i <= ry; i++) { for(int j = lx; j <= rx; j++) { if(M[i][j] == 0) { cout << "No\n"; return 0; } } } cout << "Yes\n"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Paint to make a rectangle |
User | scalalang |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 1470 Byte |
Status | AC |
Exec Time | 7 ms |
Memory | 7572 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 3476 KB |
example_01.txt | AC | 1 ms | 3480 KB |
example_02.txt | AC | 1 ms | 3332 KB |
hand_00.txt | AC | 5 ms | 7296 KB |
hand_01.txt | AC | 4 ms | 7404 KB |
hand_02.txt | AC | 4 ms | 7408 KB |
hand_03.txt | AC | 4 ms | 7572 KB |
hand_04.txt | AC | 4 ms | 7388 KB |
hand_05.txt | AC | 1 ms | 3480 KB |
hand_06.txt | AC | 1 ms | 3476 KB |
hand_07.txt | AC | 1 ms | 3480 KB |
hand_08.txt | AC | 2 ms | 7444 KB |
hand_09.txt | AC | 4 ms | 7320 KB |
hand_10.txt | AC | 4 ms | 7444 KB |
hand_11.txt | AC | 4 ms | 7436 KB |
hand_12.txt | AC | 5 ms | 7568 KB |
random_00.txt | AC | 5 ms | 7544 KB |
random_01.txt | AC | 7 ms | 7036 KB |
random_02.txt | AC | 4 ms | 7044 KB |
random_03.txt | AC | 6 ms | 7424 KB |
random_04.txt | AC | 7 ms | 7292 KB |
random_05.txt | AC | 4 ms | 7180 KB |
random_06.txt | AC | 4 ms | 7292 KB |
random_07.txt | AC | 4 ms | 7024 KB |
random_08.txt | AC | 4 ms | 7396 KB |
random_09.txt | AC | 4 ms | 6908 KB |
random_10.txt | AC | 4 ms | 7048 KB |
random_11.txt | AC | 4 ms | 7352 KB |
random_12.txt | AC | 4 ms | 7172 KB |
random_13.txt | AC | 4 ms | 7264 KB |
random_14.txt | AC | 4 ms | 7444 KB |
random_15.txt | AC | 4 ms | 7200 KB |
random_16.txt | AC | 4 ms | 7104 KB |
random_17.txt | AC | 4 ms | 7244 KB |
random_18.txt | AC | 3 ms | 7184 KB |
random_19.txt | AC | 5 ms | 7376 KB |
random_20.txt | AC | 4 ms | 7308 KB |
random_21.txt | AC | 4 ms | 7108 KB |
random_22.txt | AC | 4 ms | 7484 KB |
random_23.txt | AC | 4 ms | 7300 KB |
random_24.txt | AC | 4 ms | 7348 KB |