답안 #1017037

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1017037 2024-07-08T18:21:24 Z Kodik 악어의 지하 도시 (IOI11_crocodile) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define ss second
#define ff first
typedef long long ll;
#define int ll
int mod = 1e9+7;
int inf = 1e18;

int main(int N, int M, int R[][2], int L[], int k, int p[]){
    int n = N, m = M;
    vector<vector<pair<int,int>>> adj(n);
    for(int i = 0; i < m; ++i){
        int a = R[i][0],b = R[i][1],c = L[i];
        adj[a].push_back({b,c});
        adj[b].push_back({a,c});
    }
    set<int> exit;
    for(int i = 0; i < k; ++i){
        exit.insert(p[i]);
    }
    priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;
    vector<int> dis(n, 1e10);
    int ans = 1e10;
    dis[0] = 0;
    pq.push({0,0});
    bool pass = 0;
    while(!pq.empty()){
        pair<int,int> a = pq.top(); pq.pop();
        if(dis[a.ss]!=a.ff){
            continue;
        }
        if(exit.find(a.ss)!=exit.end()){
            ans = min(ans, a.ff);
        }
        pass = false;
        for(auto &[nxt, w] : adj[a.ss]){
            if(a.ff+w<nxt&&pass){
                pq.push({a.ff+w,nxt});
            }else if(a.ff+w>=nxt){
                continue;
            }
            pass = true;
        }        
    }
    return ans;
}

// signed main(){
//     ios_base::sync_with_stdio(false);
//     cin.tie(NULL);
//     // ifstream cin ("shortcut.in");
//     // ofstream cout ("shortcut.out");
    
//     return 0;   
// }

Compilation message

crocodile.cpp:6:13: error: '::main' must return 'int'
    6 | #define int ll
      |             ^~
crocodile.cpp:10:1: note: in expansion of macro 'int'
   10 | int main(int N, int M, int R[][2], int L[], int k, int p[]){
      | ^~~
crocodile.cpp:10:5: warning: first argument of 'int main(ll, ll, ll (*)[2], ll*, ll, ll*)' should be 'int' [-Wmain]
   10 | int main(int N, int M, int R[][2], int L[], int k, int p[]){
      |     ^~~~
crocodile.cpp:10:5: warning: second argument of 'int main(ll, ll, ll (*)[2], ll*, ll, ll*)' should be 'char **' [-Wmain]
crocodile.cpp:10:5: warning: third argument of 'int main(ll, ll, ll (*)[2], ll*, ll, ll*)' should probably be 'char **' [-Wmain]
crocodile.cpp:10:5: warning: 'int main(ll, ll, ll (*)[2], ll*, ll, ll*)' takes only zero or two arguments [-Wmain]