#include "railroad.h"
#include <bits/stdc++.h>
using namespace std;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t)
{
#define int long long
int n = (int)s.size();
vector<pair<int, int>> ss, tt;
for(int i=0;i<n;i++)
{
tt.push_back({t[i], i});
ss.push_back({s[i], i});
}
sort(ss.rbegin(), ss.rend());
sort(tt.rbegin(), tt.rend());
int i = 0, j = 1;
while(j < n)
{
if(ss[i].second != tt[j].second)
{
if(tt[j].first > ss[i].first)
return 999;
}
else if(i != 0)
{
if(tt[j].first > ss[i - 1].first)
return 999;
}
i++, j++;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
n = 2 |
2 |
Correct |
0 ms |
212 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
0 ms |
212 KB |
n = 2 |
5 |
Correct |
0 ms |
212 KB |
n = 2 |
6 |
Incorrect |
0 ms |
212 KB |
answer is not correct: 999 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
n = 2 |
2 |
Correct |
0 ms |
212 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
0 ms |
212 KB |
n = 2 |
5 |
Correct |
0 ms |
212 KB |
n = 2 |
6 |
Incorrect |
0 ms |
212 KB |
answer is not correct: 999 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
9900 KB |
n = 199999 |
2 |
Correct |
77 ms |
9896 KB |
n = 199991 |
3 |
Correct |
65 ms |
9900 KB |
n = 199993 |
4 |
Correct |
49 ms |
9020 KB |
n = 152076 |
5 |
Correct |
29 ms |
4996 KB |
n = 93249 |
6 |
Correct |
71 ms |
9892 KB |
n = 199910 |
7 |
Correct |
63 ms |
9824 KB |
n = 199999 |
8 |
Correct |
60 ms |
9900 KB |
n = 199997 |
9 |
Correct |
56 ms |
9300 KB |
n = 171294 |
10 |
Correct |
46 ms |
8800 KB |
n = 140872 |
11 |
Incorrect |
60 ms |
9896 KB |
answer is not correct: 0 instead of 1 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
n = 2 |
2 |
Correct |
0 ms |
212 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
0 ms |
212 KB |
n = 2 |
5 |
Correct |
0 ms |
212 KB |
n = 2 |
6 |
Incorrect |
0 ms |
212 KB |
answer is not correct: 999 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |