#include "railroad.h"
#include <vector>
#include <algorithm>
#include <iostream>
#define pb push_back
using namespace std;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = (int) s.size();
vector<pair<pair<int,int>,int>> arr;
for(int i=0;i<n;i++){
arr.pb({{s[i],t[i]},i});
}
sort(arr.begin(),arr.end());
int cur_speed = 1;
int ans = 0;
for(int i=0;i<n;i++){
// cout << arr[i].second << " " << arr[i].first.first << " " << arr[i].first.second << " " << cur_speed << endl;
if(arr[i].first.first < cur_speed){
ans += (cur_speed - arr[i].first.first);
}
cur_speed = arr[i].first.second;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
1 ms |
212 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
1 ms |
212 KB |
n = 2 |
5 |
Correct |
1 ms |
296 KB |
n = 2 |
6 |
Correct |
0 ms |
212 KB |
n = 2 |
7 |
Correct |
1 ms |
212 KB |
n = 3 |
8 |
Correct |
1 ms |
288 KB |
n = 3 |
9 |
Correct |
0 ms |
212 KB |
n = 3 |
10 |
Correct |
0 ms |
212 KB |
n = 8 |
11 |
Incorrect |
1 ms |
300 KB |
answer is not correct: 704164129 instead of 189002015 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
1 ms |
212 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
1 ms |
212 KB |
n = 2 |
5 |
Correct |
1 ms |
296 KB |
n = 2 |
6 |
Correct |
0 ms |
212 KB |
n = 2 |
7 |
Correct |
1 ms |
212 KB |
n = 3 |
8 |
Correct |
1 ms |
288 KB |
n = 3 |
9 |
Correct |
0 ms |
212 KB |
n = 3 |
10 |
Correct |
0 ms |
212 KB |
n = 8 |
11 |
Incorrect |
1 ms |
300 KB |
answer is not correct: 704164129 instead of 189002015 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
10420 KB |
n = 199999 |
2 |
Correct |
54 ms |
10432 KB |
n = 199991 |
3 |
Correct |
59 ms |
10412 KB |
n = 199993 |
4 |
Incorrect |
39 ms |
8512 KB |
answer is not correct: 1 instead of 0 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
1 ms |
212 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
1 ms |
212 KB |
n = 2 |
5 |
Correct |
1 ms |
296 KB |
n = 2 |
6 |
Correct |
0 ms |
212 KB |
n = 2 |
7 |
Correct |
1 ms |
212 KB |
n = 3 |
8 |
Correct |
1 ms |
288 KB |
n = 3 |
9 |
Correct |
0 ms |
212 KB |
n = 3 |
10 |
Correct |
0 ms |
212 KB |
n = 8 |
11 |
Incorrect |
1 ms |
300 KB |
answer is not correct: 704164129 instead of 189002015 |
12 |
Halted |
0 ms |
0 KB |
- |