제출 #410831

#제출 시각아이디문제언어결과실행 시간메모리
410831EJOI2019AndrewRoller Coaster Railroad (IOI16_railroad)C++14
컴파일 에러
0 ms0 KiB
#include "railroad.h"
#include<bits/stdc++.h>
#define lcm(a,b) (a/__gcd(a,b))*b
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int


//set.upper_bound(element) - iterator pointing to element greater than the given element
// | ^
//__builtin_popcount(x)
using namespace std;
long long plan_roller_coaster(vector<int> s,vector<int> t) {
    int n=(int)s.size();
    ll res=1e18;
    vi a;
    for(int i=0;i<n;i++)
        a.pb(i);
    do{
        ll G=0,c=0;
        for(int i=0;i<n;i++)
        {
            if(c>s[a[i]])
                G+=(c-s[a[i]]);
            }
            c=t[a[i]];

        res=min(res,G);
    }while(next_permutation(a.begin(),a.end()));
   return res;
}

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

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:15:5: error: 'vi' was not declared in this scope
   15 |     vi a;
      |     ^~
railroad.cpp:17:9: error: 'a' was not declared in this scope
   17 |         a.pb(i);
      |         ^
railroad.cpp:22:20: error: 'a' was not declared in this scope
   22 |             if(c>s[a[i]])
      |                    ^
railroad.cpp:25:17: error: 'a' was not declared in this scope
   25 |             c=t[a[i]];
      |                 ^
railroad.cpp:25:19: error: 'i' was not declared in this scope
   25 |             c=t[a[i]];
      |                   ^
railroad.cpp:28:29: error: 'a' was not declared in this scope
   28 |     }while(next_permutation(a.begin(),a.end()));
      |                             ^