Submission #54601516


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
int n,m,k,t,l;
char mp[210][210];
int main() {
cin>>n>>m>>k;
if (k<n||(k-n)%2) {
cout<<"No\n";
return 0;
}
cout<<"Yes\n";
for (int i=1;i<=2*n+1;i++) for (int j=1;j<=2*m+1;j++) mp[i][j]='.';
for (int i=1;i<=2*m+1;i++) mp[1][i]='+',mp[2*n+1][i]='+';
for (int i=1;i<=2*n+1;i++) mp[i][1]='+',mp[i][2*m+1]='+';
mp[1][2*m]='S';
mp[2*n+1][2*m]='G';
for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) mp[2*i][2*j]='o';
for (int i=1;i<n;i++) for (int j=1;j<m;j++) mp[2*i+1][2*j+1]='+';
if (m>1) for (int i=1;i<=n;i++) mp[2*i][2*m-1]='|';
t=(k-n)/2;
for (int i=1;i<=n/2;i++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
int n,m,k,t,l;
char mp[210][210];
int main() {
    cin>>n>>m>>k;
    if (k<n||(k-n)%2) {
        cout<<"No\n";
        return 0;
    }
    cout<<"Yes\n";
    for (int i=1;i<=2*n+1;i++) for (int j=1;j<=2*m+1;j++) mp[i][j]='.';
    for (int i=1;i<=2*m+1;i++) mp[1][i]='+',mp[2*n+1][i]='+';
    for (int i=1;i<=2*n+1;i++) mp[i][1]='+',mp[i][2*m+1]='+';
    mp[1][2*m]='S';
    mp[2*n+1][2*m]='G';
    for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) mp[2*i][2*j]='o';
    for (int i=1;i<n;i++) for (int j=1;j<m;j++) mp[2*i+1][2*j+1]='+';
    if (m>1) for (int i=1;i<=n;i++) mp[2*i][2*m-1]='|';
    t=(k-n)/2;
    for (int i=1;i<=n/2;i++) {
        if (t>0) {
            l=min(t,m-1);
            if (l<m-1) mp[4*i-2][2*m-2*l-1]='|',mp[4*i][2*m-2*l-1]='|';
            mp[4*i-2][2*m-1]='.';
            mp[4*i][2*m-1]='.';
            if (i*2<n) for (int j=m-l;j<m;j++) mp[4*i+1][2*j]='-';
            for (int j=m-l+1;j<=m;j++) mp[4*i-1][2*j]='-';
        }
        t-=m-1;
    }
    if (t>0) {
        for (int i=1;i<=t;i++) {
            mp[2*n-1][4*i-2]='.';
            mp[2*n-1][4*i]='.';
            mp[2*n-2][4*i-1]='|';
            mp[2*n][4*i+1]='|';
        }
    }
    for (int i=1;i<=2*n+1;i++) {
        for (int j=1;j<=2*m+1;j++) cout<<mp[i][j];
        cout<<endl;
    }
}

Submission Info

Submission Time
Task F - Easiest Maze
User undefined_Ryan
Language C++ 20 (gcc 12.2)
Score 525
Code Size 1371 Byte
Status AC
Exec Time 2 ms
Memory 3728 KB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:16:19: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   16 |     mp[2*n+1][2*m]='G';
      |     ~~~~~~~~~~~~~~^~~~
Main.cpp:4:6: note: at offset [-2147483648, -1] into destination object ‘mp’ of size [44100, 210]
    4 | char mp[210][210];
      |      ^~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 525 / 525
Status
AC × 3
AC × 54
Set Name Test Cases
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
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3652 KB
00_sample_01.txt AC 1 ms 3648 KB
00_sample_02.txt AC 1 ms 3644 KB
01_random_00.txt AC 1 ms 3564 KB
01_random_01.txt AC 2 ms 3524 KB
01_random_02.txt AC 1 ms 3464 KB
01_random_03.txt AC 1 ms 3692 KB
01_random_04.txt AC 1 ms 3552 KB
01_random_05.txt AC 1 ms 3488 KB
01_random_06.txt AC 1 ms 3544 KB
01_random_07.txt AC 1 ms 3548 KB
01_random_08.txt AC 1 ms 3564 KB
01_random_09.txt AC 1 ms 3468 KB
01_random_10.txt AC 1 ms 3548 KB
01_random_11.txt AC 1 ms 3500 KB
01_random_12.txt AC 1 ms 3684 KB
01_random_13.txt AC 1 ms 3688 KB
01_random_14.txt AC 1 ms 3464 KB
01_random_15.txt AC 1 ms 3616 KB
01_random_16.txt AC 1 ms 3436 KB
01_random_17.txt AC 1 ms 3624 KB
01_random_18.txt AC 1 ms 3544 KB
01_random_19.txt AC 1 ms 3536 KB
01_random_20.txt AC 1 ms 3544 KB
01_random_21.txt AC 1 ms 3684 KB
01_random_22.txt AC 1 ms 3544 KB
01_random_23.txt AC 2 ms 3564 KB
01_random_24.txt AC 1 ms 3500 KB
01_random_25.txt AC 2 ms 3580 KB
01_random_26.txt AC 1 ms 3552 KB
01_random_27.txt AC 2 ms 3500 KB
01_random_28.txt AC 1 ms 3528 KB
01_random_29.txt AC 2 ms 3500 KB
01_random_30.txt AC 2 ms 3508 KB
01_random_31.txt AC 1 ms 3568 KB
01_random_32.txt AC 2 ms 3688 KB
01_random_33.txt AC 1 ms 3416 KB
01_random_34.txt AC 1 ms 3504 KB
01_random_35.txt AC 1 ms 3548 KB
01_random_36.txt AC 1 ms 3520 KB
01_random_37.txt AC 1 ms 3616 KB
01_random_38.txt AC 2 ms 3728 KB
01_random_39.txt AC 2 ms 3540 KB
01_random_40.txt AC 1 ms 3440 KB
01_random_41.txt AC 1 ms 3500 KB
01_random_42.txt AC 2 ms 3524 KB
01_random_43.txt AC 1 ms 3528 KB
01_random_44.txt AC 2 ms 3532 KB
01_random_45.txt AC 2 ms 3532 KB
01_random_46.txt AC 1 ms 3648 KB
01_random_47.txt AC 1 ms 3568 KB
01_random_48.txt AC 2 ms 3600 KB
02_handmade_00.txt AC 2 ms 3604 KB
02_handmade_01.txt AC 2 ms 3656 KB


2025-03-05 (Wed)
20:49:40 +00:00