# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
354719 | kylych03 | Roller Coaster Railroad (IOI16_railroad) | C++14 | 526 ms | 32364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "railroad.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
#define ll long long
using namespace std;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = (int) s.size();
map <ll, ll> mp;
map <ll, ll> ::iterator it;
for(int i = 0 ; i < n;i++){
mp[s[i]]--;
mp[t[i]]++;
}
mp[0]++;
ll cnt = 0, res, last = 0;
for( it = mp.begin() ; it!=mp.end() ; it++){
cnt += it->second;
//cout << cnt<< " - " <<it->first<<" - " <<it->second<<endl;
if(cnt < 0){
// cout << cnt <<" ok " <<it->first <<" - " << last << endl;
res+= ( cnt * (it->first - last) );
}
last = it->first;
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |