QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#528521 | #6398. Puzzle: Tapa | hnust_xiaoqi# | WA | 0ms | 3752kb | C++20 | 2.3kb | 2024-08-23 15:42:47 | 2024-08-23 15:42:47 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
const int N = 150;
typedef long long LL;
typedef pair<int, int> PII;
int n, m;
char a[N][N], b[N][N];
void solve() {
cin >> n >> m;
n = n * 2 - 1; m = m * 2 - 1;
memset(a, '.', sizeof a);
for(int i = 6; i <= n + 5; i++) {
for(int j = 6; j <= m + 5; j++) {
cin >> a[i][j];
if(a[i][j] == '.') a[i][j] = '#';
b[i][j] = a[i][j];
}
}
// for(int i = 5; i <= n + 6; i++) {
// for(int j = 5; j <= m + 6; j++) cout << a[i][j];
// cout << endl;
// }
for(int i = 6; i <= n + 5; i++) {
for(int j = 6; j <= m + 5; j++) {
if(a[i][j] == '2' && (a[i][j + 2] == '4' || a[i][j + 2] == '2')) a[i][j + 1] = '.', a[i][j]++, a[i][j + 2]++;
if(a[i][j] == '4' && (a[i][j + 2] == '4' || a[i][j + 2] == '7')) a[i][j + 1] = '.', a[i][j]++, a[i][j + 2]++;
if(a[i][j] == '7' && (a[i][j + 2] == '7' || a[i][j + 2] == '4')) a[i][j + 1] = '.', a[i][j]++, a[i][j + 2]++;
}
}
for(int i = 6; i <= n + 5; i++) {
for(int j = 6; j <= m + 5; j++) {
if(a[j][i] == '2' && (a[j + 2][i] == '4' || a[j + 2][i] == '2')) a[j + 1][i] = '.';
if(a[j][i] == '4' && (a[j + 2][i] == '4' || a[j + 2][i] == '7')) a[j + 1][i] = '.';
if(a[j][i] == '7' && (a[j + 2][i] == '7' || a[j + 2][i] == '4')) a[j + 1][i] = '.';
}
}
// cout << endl;
// for(int i = 5; i <= n + 6; i++) {
// for(int j = 5; j <= m + 6; j++) cout << a[i][j];
// cout << endl;
// }
for(int i = 6; i <= n + 5; i++) {
for(int j = 6; j <= m + 5; j++) {
if(a[i][j] == '#') {
if(a[i - 1][j] != '#' && a[i + 1][j] != '#' && a[i][j - 1] != '#' && a[i][j + 1] != '#') {
cout << "NO\n";
return ;
}
}
if(a[i][j] == '.') {
if(a[i - 1][j] == '#' && a[i + 1][j] == '#') {
cout << "NO\n";
return ;
}
if(a[i][j - 1] == '#' && a[i][j + 1] == '#') {
cout << "NO\n";
return ;
}
}
}
}
cout << "YES\n";
for(int i = 6; i <= n + 5; i++) {
for(int j = 6; j <= m + 5; j++) {
if(a[i][j] >= '0' && a[i][j] <= '9') cout << b[i][j];
else cout << a[i][j];
}
cout << endl;
}
}
signed main()
{
ios::sync_with_stdio(false), cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while(t--) {
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
input:
3 3 2.4.3 ..... 5.8.5 ..... 3.5.3
output:
YES 2.4#3 ##### 5#8#5 ##### 3#5#3
result:
ok Correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
3 3 3.4.3 ..... 5.7.5 ..... 3.5.3
output:
NO
result:
ok Correct.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
2 2 2.2 ... 2.2
output:
YES 2.2 ### 2.2
result:
ok Correct.
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
2 50 2.4.4.4.4.5.5.5.5.5.5.5.5.4.5.5.4.4.5.5.5.5.4.5.5.5.5.5.4.4.5.4.5.5.5.5.5.5.5.5.5.5.5.4.4.5.5.4.5.3 ................................................................................................... 2.5.5.4.4.5.5.5.4.4.5.5.5.4.5.5.5.5.5.5.5.5.4.4.4.5.5.5.5.5.5.4.4.4.5.5.5.5.5.5.5.4.4.5.5.5.5.4...
output:
YES 2.4#4.4#4#5#5#5#5#5#5#5#5#4#5#5#4.4#5#5#5#5#4#5#5#5#5#5#4.4#5#4#5#5#5#5#5#5#5#5#5#5#5#4.4#5#5#4#5#3 ################################################################################################### 2#5#5#4.4#5#5#5#4.4#5#5#5#4#5#5#5#5#5#5#5#5#4.4#4#5#5#5#5#5#5#4.4#4#5#5#5#5#5#5#5#4.4#5#5#5#5#4#...
result:
wrong answer Clue not satisfied at (1,9)