제출 #547653

#제출 시각아이디문제언어결과실행 시간메모리
547653status_coding여행하는 상인 (APIO17_merchant)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>

using namespace std;

void calcDist()
{
    for(int k=1;k<=n;k++)
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++)
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
}

void calcProfit()
{

}


int main()
{
    cin>>n>>m>>k;

    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=k; j++)
            cin>>buy[i][j]>>sell[i][j];
    }

    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
        {
            if(i == j)
                continue;

            dist[i][j] = 1e18;
        }

    for(int i=1;i<=m;i++)
    {
        long long x, y, val;
        cin>>x>>y>>val;

        dist[x][y] = min(dist[x][y], val);
    }

    calcDist();
    calcProfit();

    st=0;
    dr=1e18;

    while(st <= dr)
    {
        mij = (st+dr)/2;

        if(ok(mij))
        {
            last=mij;
            st=mij+1;
        }
        else
            dr=mij-1;
    }

    cout<<last;
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

merchant.cpp: In function 'void calcDist()':
merchant.cpp:7:20: error: 'n' was not declared in this scope
    7 |     for(int k=1;k<=n;k++)
      |                    ^
merchant.cpp:10:17: error: 'dist' was not declared in this scope
   10 |                 dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      |                 ^~~~
merchant.cpp: In function 'int main()':
merchant.cpp:21:10: error: 'n' was not declared in this scope
   21 |     cin>>n>>m>>k;
      |          ^
merchant.cpp:21:13: error: 'm' was not declared in this scope; did you mean 'tm'?
   21 |     cin>>n>>m>>k;
      |             ^
      |             tm
merchant.cpp:21:16: error: 'k' was not declared in this scope
   21 |     cin>>n>>m>>k;
      |                ^
merchant.cpp:26:18: error: 'buy' was not declared in this scope
   26 |             cin>>buy[i][j]>>sell[i][j];
      |                  ^~~
merchant.cpp:26:29: error: 'sell' was not declared in this scope
   26 |             cin>>buy[i][j]>>sell[i][j];
      |                             ^~~~
merchant.cpp:35:13: error: 'dist' was not declared in this scope
   35 |             dist[i][j] = 1e18;
      |             ^~~~
merchant.cpp:43:9: error: 'dist' was not declared in this scope
   43 |         dist[x][y] = min(dist[x][y], val);
      |         ^~~~
merchant.cpp:49:5: error: 'st' was not declared in this scope; did you mean 'std'?
   49 |     st=0;
      |     ^~
      |     std
merchant.cpp:50:5: error: 'dr' was not declared in this scope
   50 |     dr=1e18;
      |     ^~
merchant.cpp:54:9: error: 'mij' was not declared in this scope
   54 |         mij = (st+dr)/2;
      |         ^~~
merchant.cpp:56:12: error: 'ok' was not declared in this scope
   56 |         if(ok(mij))
      |            ^~
merchant.cpp:58:13: error: 'last' was not declared in this scope
   58 |             last=mij;
      |             ^~~~
merchant.cpp:65:11: error: 'last' was not declared in this scope
   65 |     cout<<last;
      |           ^~~~