답안 #1050932

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1050932 2024-08-09T17:00:57 Z Itamar Sky Walking (IOI19_walk) C++14
컴파일 오류
0 ms 0 KB
using namespace std;
#include "stdc++.h"
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pi pair<ll,ll>
#define vi vector<int>
long long min_distance(std::vector<int> x, std::vector<int> h, std::vector<int> l, std::vector<int> r, std::vector<int> y, int s, int g) {
	int n = x.size(), m = l.size();
    map<pi,vector<pi>> fr;
    /*multiset<pi> poi;
    vector<vector<pi>> ins(2e5+2);
    vector<vector<pi>> rem(2e5+2);
    for(int i = 0; i < m; i++){
        ins[l[i]].push_back({y[i],i});
        rem[r[i]].push_back({y[i],i});
    }
    map<int,int> prev;
    for(int i = 0; i < n; i++){
        for(pi hei : ins[i])poi.insert(hei);
        pi bel = {x[i],0};
        auto it = poi.begin();
        while(it!=poi.end() && (*it).first <= h[i]){
            int cur = (*it).first;
            pi p = {x[i],cur};
            fr[p].push_back(bel);
            fr[bel].push_back(p);
            if(l[(*it).second]!=i){
                fr[p].push_back({prev[cur],cur});
                fr[{prev[cur],cur}].push_back(p);
            }
            prev[cur]=x[i];
            bel = p;
            it++;
        }
        for(pi hei : rem[i])poi.erase(poi.find(hei));
    }*/
    map<pi,ll> dp;
    dp[{x[g],0}]=1e18;
    dp[{x[s],0}]=0;
    for(int i = 0; i < m; i++){
        for(int j = l[i]; j <=r[i]; j++){
            for(int k = l[i]; k <= r[i]; k++){
                if(y[i] <= h[j] && y[i] <= h[k]){
                    fr[{x[j],y[i]}].push_back({x[k],y[i]});
                    dp[{x[j],y[i]}]=1e18;
                }
            }
        }
    }
    for(auto[a,b] : dp){
        for(auto [c,d] : dp){
            if(c.first == a.first)fr[a].push_back(c);
        }
    }
    set<pair<ll,pi>> se;
    map<pi,bool> vis;
    se.insert({0,{x[s],0}});
    while(!se.empty()){
        pair<ll,pi> p = *se.begin();
        pi q = p.second;
        se.erase(se.begin());
        if(vis[q])continue;
        vis[q]=1;
        for(pi f : fr[q]){
            if(vis[f])continue;
            ll w = dp[q] + (abs(f.first-q.first)+abs(f.second-q.second));
            se.insert({w,f});
            dp[f] = min(dp[f],w);
        }
    }
    if(dp[{x[g],0}]==0 || dp[{x[g],0}]>=1e16)return -1;
    return dp[{x[g],0}];
}

Compilation message

walk.cpp:2:10: fatal error: stdc++.h: No such file or directory
    2 | #include "stdc++.h"
      |          ^~~~~~~~~~
compilation terminated.