QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#493061 | #5934. Minesweeper Master | wendyasif | 0 | 2ms | 3808kb | C++14 | 2.0kb | 2024-07-26 19:08:42 | 2024-07-26 19:08:42 |
answer
#include<bits/stdc++.h>
using namespace std;
#define LL long long
int T,n,m,s,t;
//char ans[55][55];
int main(){
// freopen("minesweeper.in","r",stdin);
// freopen("minesweeper.out","w",stdout);
scanf("%d",&T);
while(T--){
scanf("%d%d%d",&n,&m,&s);
printf("Case #%d:\n",++t);
if(n>=2&&m>=2){
if(n*m-s==1){
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(i==n&&j==m) printf("c");
else printf("*");
}
printf("\n");
}
continue;
}
bool flag=1;
for(int i=2,k,l,i1;i<=n*m-s&&i<=n;i++){
k=(n*m-s)/i,l=(n*m-s)%i;
while(l==1||k>n&&k>m)
k--,l+=i;
if(l!=1&&(l<=k||l<=i&&k<m)&&k>=2&&k<=m){
flag=0;
if(l<=m){
for(int ja=1;ja<=n;ja++){
for(int jb=1;jb<=m;jb++){
if(ja>=n-i+1&&jb>=m-k+1||ja==n-i&&jb>=m-l+1){
if(ja==n&&jb==m) printf("c");
else printf(".");
}else printf("*");
}
printf("\n");
}
}else{
for(int ja=1;ja<=n;ja++){
for(int jb=1;jb<=m;jb++){
if(ja>=n-i+1&&jb>=m-k+1||jb==m-k&&ja>=n-l+1){
if(ja==n&&jb==m) printf("c");
else printf(".");
}else printf("*");
}
printf("\n");
}
}
break;
}
}
if(flag)
printf("Impossible\n");
}else if(n==2||m==2){
if(n*m-s==2||n*m-s==3){
printf("Impossible\n");
continue;
}
bool flag=n*m-s==1;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(i>=n-1&&j>=n-1||s==0){
if(i==n&&j==m) printf("c");
else if(flag) printf("*");
else printf(".");
}else{
printf("*");
s--;
}
}
printf("\n");
}
}else if(n==1||m==1){
if(m==1){
for(int i=1;i<n;i++){
if(i<=s) printf("*\n");
else printf(".\n");
}
printf("c\n");
}else{
for(int i=1;i<m;i++){
if(i<=s) printf("*");
else printf(".");
}
printf("c\n");
}
}
}
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3752kb
input:
225 5 5 21 4 4 14 4 4 15 5 5 23 3 2 4 2 5 8 4 4 5 5 5 15 5 4 1 4 5 12 3 5 5 5 2 5 4 5 6 5 3 14 5 4 17 2 5 5 4 5 8 4 5 16 2 1 1 4 3 7 4 3 10 1 4 1 2 3 4 2 3 1 4 3 5 4 2 1 5 3 12 5 2 6 4 5 18 4 3 4 2 4 4 1 2 1 4 5 11 2 3 5 2 4 1 3 3 8 4 5 2 2 2 3 4 4 12 2 3 0 4 4 2 4 5 7 2 5 9 5 5 13 3 4 6 5 5 22 1 3 ...
output:
Case #1: ***** ***** ***** ***.. ***.c Case #2: Impossible Case #3: **** **** **** ***c Case #4: Impossible Case #5: Impossible Case #6: Impossible Case #7: **** *... .... ...c Case #8: ***** ***** ***** ..... ....c Case #9: *... .... .... .... ...c Case #10: ***** ***** *.... *...c Case #11: ***** ...
result:
wrong answer there should be exactly 2 mine(s), but there are 5 mine(s) in your plan (test case 75)
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 2ms
memory: 3808kb
input:
134 50 50 250 50 50 2494 50 50 2495 2 50 4 50 3 2 2 50 48 50 50 2448 50 50 2499 3 50 5 4 4 2 3 3 5 50 1 3 2 50 45 1 50 2 50 50 48 50 2 46 2 50 46 3 3 2 50 1 48 50 50 248 50 50 251 1 50 1 2 50 3 50 2 1 50 50 51 4 4 11 50 1 2 4 4 10 3 50 44 50 50 50 2 50 42 2 2 1 50 2 47 50 2 3 50 2 4 50 3 43 50 50 24...
output:
Case #1: ************************************************** ************************************************** ************************************************** ************************************************** ************************************************** .......................................
result:
wrong answer Token "************************.........................." doesn't correspond to pattern "Impossible" (test case 13)