Submission #815104

#TimeUsernameProblemLanguageResultExecution timeMemory
815104jajcoSightseeing in Kyoto (JOI22_kyoto)C++17
10 / 100
8 ms8204 KiB
#include <ios>
#include <vector>
#define REP(i, n) for(int i=0; i<n; ++i)
#define INF 1e18
typedef long long ll;
typedef std::vector <int> vi;
typedef std::vector <ll> vll;
void M(ll &i, const ll j){
    i=std::min(i, j);
}
int main(){
    int n,m; // n to kolumny!
    scanf("%d%d", &n, &m);
    if (n>1000||m>1000)
        return 69;
    vi kol(n),wier(m);
    REP(i, n)
        scanf("%d", &kol[i]);
    REP(i, m)
        scanf("%d", &wier[i]);
    std::vector <vll> odl(n+1, vll(m+1, INF));
    odl[0][0]=0;
    REP(x, n)
        REP(y, m){
            M(odl[x+1][y], odl[x][y]+wier[y]);
            M(odl[x][y+1], odl[x][y]+kol[x]);
        }
    printf("%lld\n", odl[n-1][m-1]);
}

Compilation message (stderr)

kyoto.cpp: In function 'int main()':
kyoto.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
kyoto.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%d", &kol[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
kyoto.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d", &wier[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...