Submission #1031690

#TimeUsernameProblemLanguageResultExecution timeMemory
1031690pccRoller Coaster Railroad (IOI16_railroad)C++17
Compilation error
0 ms0 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define fs first #define sc second #define pll pair<ll,ll> #define _all(T) T.begin(),T.end() //claim always can be connected const ll inf = 1e18; const int mxn = 2e5+10; vector<int> all; int deg[mxn*3]; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int N = (int)s.size(); vector<int> v(N);iota(v.begin(),v.end(),0); sort(v.begin(),v.end(),[](int a,int b){return t[a]<s[b];}); for(int i = 1;i<N;i++){ int pre = v[i-1],now = v[i]; if(t[pre]>s[now])return 1; } return 0; }

Compilation message (stderr)

railroad.cpp: In lambda function:
railroad.cpp:22:48: error: 't' is not captured
   22 |  sort(v.begin(),v.end(),[](int a,int b){return t[a]<s[b];});
      |                                                ^
railroad.cpp:22:26: note: the lambda has no capture-default
   22 |  sort(v.begin(),v.end(),[](int a,int b){return t[a]<s[b];});
      |                          ^
railroad.cpp:19:68: note: 'std::vector<int> t' declared here
   19 | long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
      |                                                   ~~~~~~~~~~~~~~~~~^
railroad.cpp:22:53: error: 's' is not captured
   22 |  sort(v.begin(),v.end(),[](int a,int b){return t[a]<s[b];});
      |                                                     ^
railroad.cpp:22:26: note: the lambda has no capture-default
   22 |  sort(v.begin(),v.end(),[](int a,int b){return t[a]<s[b];});
      |                          ^
railroad.cpp:19:48: note: 'std::vector<int> s' declared here
   19 | long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
      |                               ~~~~~~~~~~~~~~~~~^