提出 #54654028


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
const int MAX=210;
int n,m,k,x,y;
string s[MAX];
inline int read(){
	int x=0,f=1;char c=getchar();
	while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
	while(c<='9'&&c>='0'){x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	return x*f;
}
signed main(){
    n=read();m=read();k=read();
    if(k<n||k>n*m){printf("No");return 0;}
    for(int i=1;i<=m*2+1;++i)  s[1]+='+',s[n*2+1]+='+';
    s[1][m*2-1]='S';s[n*2+1][m*2-1]='G';
    for(int i=2;i<n*2+1;++i){
        s[i]+='+';
        for(int j=2;j<=m*2;++j){
            if(i&1){
                if(j&1)  s[i]+='+';
                else  s[i]+='-';
            }else{
                if(j&1)  s[i]+='|';
                else  s[i]+='o';
            }  
            
        }s[i]+='+';
    }
    for(int i=1;i<=n;++i){
        if(n-i==2){
            if(k%2==0||(k-1)/2>m){
                // cout<<i<<" 1"<<endl;
                if(k<m*2+1){printf("No");return 0;}
                k-=m*2+1;
                if(k%2==0&&k+1<=m){
                    for(int j=1;j<m;++j)
                        s[i*2][j*2]='.';
                    s[i*2+1][1]='.';s[i*2+3][1]='.';
                    for(int j=2;j-1<=k;j+=2){
                        s[n*2][j*2-2]='.';s[n*2-1][j*2-1]='.';
                        s[i*2+2][j*2]='.';s[n*2-1][j*2+1]='.';
                    }for(int j=k+2;j<=m;++j)  s[n*2][j*2-2]='.';
                    break;
                }else{printf("No");return 0;}
            }
        }
        if(i+1<=n&&m*2+(n-i-1)<=k){
                // cout<<i<<" 2"<<endl;
            for(int j=1;j<m;++j)
                s[i*2][j*2]='.',s[i*2+2][j*2]='.';
            s[i*2+1][1]='.';
            if(i+1<n)  s[i*2+3][m*2-1]='.';k-=m*2;++i;continue;
        }if(i+1<=n&&(k-(n-i-1))%2==0){
            x=(k-(n-i-1))/2;
                // cout<<i<<" 3"<<endl;
            for(int j=m-x+1;j<m;++j)
                s[i*2][j*2]='.',s[i*2+2][j*2]='.';
            s[i*2+1][(m-x+1)*2-1]='.';
            if(i+1<n)  s[i*2+3][m*2-1]='.';k-=x*2;++i;continue;
        }
        if(n-i+1==k){
                // cout<<i<<" 4"<<endl;
            if(i<n)  s[i*2+1][m*2-1]='.';--k;continue;
        }
         
    }printf("Yes\n");
    for(int i=1;i<=n*2+1;++i)  cout<<s[i]<<endl;
}

提出情報

提出日時
問題 F - Easiest Maze
ユーザ yswn
言語 C++ 20 (gcc 12.2)
得点 0
コード長 2315 Byte
結果 WA
実行時間 2 ms
メモリ 3764 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:53:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   53 |             if(i+1<n)  s[i*2+3][m*2-1]='.';k-=m*2;++i;continue;
      |             ^~
Main.cpp:53:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   53 |             if(i+1<n)  s[i*2+3][m*2-1]='.';k-=m*2;++i;continue;
      |                                            ^
Main.cpp:60:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   60 |             if(i+1<n)  s[i*2+3][m*2-1]='.';k-=x*2;++i;continue;
      |             ^~
Main.cpp:60:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   60 |             if(i+1<n)  s[i*2+3][m*2-1]='.';k-=x*2;++i;continue;
      |                                            ^
Main.cpp:64:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   64 |             if(i<n)  s[i*2+1][m*2-1]='.';--k;continue;
      |             ^~
Main.cpp:64:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   64 |             if(i<n)  s[i*2+1][m*2-1]='.';--k;continue;
      |                                          ^~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 525
結果
AC × 3
AC × 41
WA × 13
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt, 01_random_35.txt, 01_random_36.txt, 01_random_37.txt, 01_random_38.txt, 01_random_39.txt, 01_random_40.txt, 01_random_41.txt, 01_random_42.txt, 01_random_43.txt, 01_random_44.txt, 01_random_45.txt, 01_random_46.txt, 01_random_47.txt, 01_random_48.txt, 02_handmade_00.txt, 02_handmade_01.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3440 KiB
00_sample_01.txt AC 1 ms 3708 KiB
00_sample_02.txt AC 1 ms 3480 KiB
01_random_00.txt WA 1 ms 3724 KiB
01_random_01.txt AC 1 ms 3564 KiB
01_random_02.txt WA 1 ms 3672 KiB
01_random_03.txt WA 1 ms 3548 KiB
01_random_04.txt AC 1 ms 3440 KiB
01_random_05.txt AC 1 ms 3548 KiB
01_random_06.txt AC 1 ms 3508 KiB
01_random_07.txt AC 1 ms 3580 KiB
01_random_08.txt AC 1 ms 3456 KiB
01_random_09.txt AC 1 ms 3544 KiB
01_random_10.txt WA 1 ms 3524 KiB
01_random_11.txt WA 1 ms 3640 KiB
01_random_12.txt AC 1 ms 3584 KiB
01_random_13.txt AC 1 ms 3540 KiB
01_random_14.txt AC 1 ms 3504 KiB
01_random_15.txt WA 1 ms 3488 KiB
01_random_16.txt AC 1 ms 3524 KiB
01_random_17.txt WA 1 ms 3456 KiB
01_random_18.txt AC 1 ms 3672 KiB
01_random_19.txt AC 1 ms 3708 KiB
01_random_20.txt AC 1 ms 3580 KiB
01_random_21.txt AC 1 ms 3500 KiB
01_random_22.txt AC 1 ms 3652 KiB
01_random_23.txt AC 1 ms 3576 KiB
01_random_24.txt WA 1 ms 3564 KiB
01_random_25.txt AC 1 ms 3592 KiB
01_random_26.txt AC 1 ms 3592 KiB
01_random_27.txt AC 2 ms 3592 KiB
01_random_28.txt AC 1 ms 3692 KiB
01_random_29.txt AC 2 ms 3484 KiB
01_random_30.txt AC 1 ms 3592 KiB
01_random_31.txt WA 1 ms 3504 KiB
01_random_32.txt AC 1 ms 3720 KiB
01_random_33.txt AC 1 ms 3752 KiB
01_random_34.txt AC 1 ms 3764 KiB
01_random_35.txt AC 1 ms 3688 KiB
01_random_36.txt AC 1 ms 3520 KiB
01_random_37.txt AC 1 ms 3648 KiB
01_random_38.txt AC 1 ms 3564 KiB
01_random_39.txt AC 1 ms 3556 KiB
01_random_40.txt WA 1 ms 3548 KiB
01_random_41.txt WA 1 ms 3744 KiB
01_random_42.txt AC 1 ms 3536 KiB
01_random_43.txt AC 1 ms 3692 KiB
01_random_44.txt AC 2 ms 3628 KiB
01_random_45.txt AC 1 ms 3620 KiB
01_random_46.txt WA 1 ms 3620 KiB
01_random_47.txt WA 1 ms 3568 KiB
01_random_48.txt AC 1 ms 3632 KiB
02_handmade_00.txt AC 1 ms 3620 KiB
02_handmade_01.txt AC 2 ms 3568 KiB