Submission #18045218


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
int f[105][105];
char mp[105][105];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)scanf("%s",mp[i]+1);
    f[1][1]=(mp[1][1]=='#');
    for(int i=1;i<=n;i++)
        for(int j=1+(i==1);j<=m;j++)
        {
            f[i][j]=1e9;
            if(i>1)f[i][j]=f[i-1][j]+(mp[i][j]=='#'&&mp[i-1][j]=='.');
            if(j>1)f[i][j]=min(f[i][j],f[i][j-1]+(mp[i][j]=='#'&&mp[i][j-1]=='.'));
        }
    printf("%d",f[n][m]);
    return 0;
}

Submission Info

Submission Time
Task A - Range Flip Find Route
User AzusaCat
Language C++ (GCC 9.2.1)
Score 400
Code Size 530 Byte
Status AC
Exec Time 8 ms
Memory 3804 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    8 |     scanf("%d%d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~
./Main.cpp:9:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    9 |     for(int i=1;i<=n;i++)scanf("%s",mp[i]+1);
      |                          ~~~~~^~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 17
Set Name Test Cases
Sample example_00, example_01, example_02, example_03
All corner_00, corner_01, example_00, example_01, example_02, example_03, kuronuri_00, max_answer_00, max_answer_01, max_answer_02, max_random_00, max_random_01, max_random_02, max_random_03, one_path_00, one_path_01, one_path_02
Case Name Status Exec Time Memory
corner_00 AC 8 ms 3768 KiB
corner_01 AC 3 ms 3792 KiB
example_00 AC 2 ms 3728 KiB
example_01 AC 2 ms 3580 KiB
example_02 AC 2 ms 3632 KiB
example_03 AC 2 ms 3720 KiB
kuronuri_00 AC 3 ms 3768 KiB
max_answer_00 AC 2 ms 3760 KiB
max_answer_01 AC 2 ms 3768 KiB
max_answer_02 AC 2 ms 3668 KiB
max_random_00 AC 2 ms 3764 KiB
max_random_01 AC 3 ms 3628 KiB
max_random_02 AC 2 ms 3632 KiB
max_random_03 AC 2 ms 3804 KiB
one_path_00 AC 2 ms 3760 KiB
one_path_01 AC 2 ms 3760 KiB
one_path_02 AC 3 ms 3764 KiB