Submission #940311

# Submission time Handle Problem Language Result Execution time Memory
940311 2024-03-07T07:57:43 Z andrei_boaca Sightseeing in Kyoto (JOI22_kyoto) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const ll INF=1e17;
ll n,m;
ll lin[100005],col[100005],dp[1005][1005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>lin[i];
    for(int i=1;i<=m;i++)
        cin>>col[i];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(i!=1||j!=1)
            {
                dp[i][j]=INF;
                if(i>1)
                    dp[i][j]=min(dp[i][j],dp[i-1][j]+col[j]);
                if(j>1)
                    dp[i][j]=min(dp[i][j],dp[i][j-1]+lin[i]);
            }
 	int i=n,j=m;
    int prv=0;
    int changes=0;
    while(i!=1||j!=1)
    {
        if(from[i][j]!=prv&&prv!=0)
            changes++;
        prv=from[i][j];
        if(from[i][j]==1)
            i--;
        else
            j--;
    }
    assert(changes<=15);
    cout<<dp[n][m];
    return 0;
}

Compilation message

kyoto.cpp: In function 'int main()':
kyoto.cpp:17:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   17 |     for(int i=1;i<=n;i++)
      |     ^~~
kyoto.cpp:27:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   27 |   int i=n,j=m;
      |   ^~~
kyoto.cpp:32:12: error: 'from' was not declared in this scope
   32 |         if(from[i][j]!=prv&&prv!=0)
      |            ^~~~
kyoto.cpp:34:13: error: 'from' was not declared in this scope
   34 |         prv=from[i][j];
      |             ^~~~