# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72998 | 2018-08-27T12:58:01 Z | Kmcode | Roller Coaster Railroad (IOI16_railroad) | C++14 | 139 ms | 15840 KB |
#include<bits/stdc++.h> using namespace std; //#include "railroad.h" vector<pair<int,int> > v; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); for(int i=0;i<n;i++){ if(s[i]==t[i])continue; v.push_back(make_pair(s[i],1)); v.push_back(make_pair(t[i],0)); } sort(v.begin(),v.end()); reverse(v.begin(),v.end()); bool ok=false; int stk=0; int en=0; for(int i=0;i<v.size();i++){ if(v[i].second==1){ stk++; } else{ if(stk){ stk--; continue; } if(stk==0){ if(en==0){ en=1; break; } ok=true; break; } } } return ok; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | n = 2 |
2 | Correct | 2 ms | 356 KB | n = 2 |
3 | Correct | 3 ms | 432 KB | n = 2 |
4 | Correct | 2 ms | 472 KB | n = 2 |
5 | Correct | 3 ms | 552 KB | n = 2 |
6 | Incorrect | 2 ms | 552 KB | answer is not correct: 0 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | n = 2 |
2 | Correct | 2 ms | 356 KB | n = 2 |
3 | Correct | 3 ms | 432 KB | n = 2 |
4 | Correct | 2 ms | 472 KB | n = 2 |
5 | Correct | 3 ms | 552 KB | n = 2 |
6 | Incorrect | 2 ms | 552 KB | answer is not correct: 0 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 139 ms | 11776 KB | n = 199999 |
2 | Incorrect | 135 ms | 15840 KB | answer is not correct: 0 instead of 1 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | n = 2 |
2 | Correct | 2 ms | 356 KB | n = 2 |
3 | Correct | 3 ms | 432 KB | n = 2 |
4 | Correct | 2 ms | 472 KB | n = 2 |
5 | Correct | 3 ms | 552 KB | n = 2 |
6 | Incorrect | 2 ms | 552 KB | answer is not correct: 0 instead of 523688153 |
7 | Halted | 0 ms | 0 KB | - |