# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
827575 | 2023-08-16T14:52:49 Z | tolbi | Roller Coaster Railroad (IOI16_railroad) | C++17 | 72 ms | 8276 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; #include "railroad.h" mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count()); long long plan_roller_coaster(vector<int> s, vector<int> t) { vector<pair<int,int>> arr; for (int i = 0; i < s.size(); i++){ if (s[i]==t[i]) continue; int c = 1; if (s[i]>=t[i]){ c=-1; } arr.push_back({min(s[i],t[i]),c}); arr.push_back({max(s[i],t[i])+1,-c}); } sort(arr.begin(), arr.end()); ll crr = 0; int n = arr.size(); ll ans = 0; for (int i = 0; i < n; i++){ if (i<n-1 && arr[i].first==arr[i+1].first){ crr+=arr[i].second; continue; } crr+=arr[i].second; if (crr>0){ ans+=crr*(arr[i+1].first-arr[i].first); } } return ans; }//az ver
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | n = 2 |
2 | Correct | 1 ms | 304 KB | n = 2 |
3 | Correct | 0 ms | 212 KB | n = 2 |
4 | Correct | 0 ms | 212 KB | n = 2 |
5 | Correct | 0 ms | 212 KB | n = 2 |
6 | Incorrect | 1 ms | 212 KB | answer is not correct: 1229672758 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | n = 2 |
2 | Correct | 1 ms | 304 KB | n = 2 |
3 | Correct | 0 ms | 212 KB | n = 2 |
4 | Correct | 0 ms | 212 KB | n = 2 |
5 | Correct | 0 ms | 212 KB | n = 2 |
6 | Incorrect | 1 ms | 212 KB | answer is not correct: 1229672758 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 67 ms | 8276 KB | n = 199999 |
2 | Correct | 68 ms | 8248 KB | n = 199991 |
3 | Correct | 72 ms | 8248 KB | n = 199993 |
4 | Correct | 51 ms | 7484 KB | n = 152076 |
5 | Correct | 31 ms | 4560 KB | n = 93249 |
6 | Incorrect | 64 ms | 8244 KB | answer is not correct: 1 instead of 0 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | n = 2 |
2 | Correct | 1 ms | 304 KB | n = 2 |
3 | Correct | 0 ms | 212 KB | n = 2 |
4 | Correct | 0 ms | 212 KB | n = 2 |
5 | Correct | 0 ms | 212 KB | n = 2 |
6 | Incorrect | 1 ms | 212 KB | answer is not correct: 1229672758 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |