Submission #88587

# Submission time Handle Problem Language Result Execution time Memory
88587 2018-12-06T22:03:41 Z amiratou Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
236 ms 32800 KB
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define fi first
#define se second
#define ll long long
#define ii pair<int,int>
#define v vector<int>
#define vv vector<vector<int> >
#define pb push_back
#define INF LLONG_MAX
using namespace std;
vector<int> limit,exitsp;
int n;
set<pair<int,int> > myset;
bool check(ll curr){
	while(!myset.empty()){
		/*debug(curr);
		for(auto it:myset)
			cout<<it.fi<<" "<<it.se<<"\n";
		sep()*/
		auto search=myset.upper_bound({curr,0});
		if(search==myset.end())return 0;
		//debug(search->fi);
		if(search!=myset.begin()){
			search--;
			if(search->fi<curr)
				search++;
		}
		curr=exitsp[search->se];
		myset.erase(search);
	}
	return 1;
}
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    n = (int) s.size();
    exitsp=t;
    for (int i = 0; i < n; ++i)
    	myset.insert({s[i],i});
    auto temp=myset.begin();
    myset.erase(myset.begin());
    /*for (int i = 0; i < n; ++i)
    {
    	//debug(i);
    	myset.erase(myset.find({s[i],i}));*/
    	if(check(t[temp->se]))
    		return 0;
    	/*myset.clear();
    	for (int j = 0; j < n; ++j)
    		myset.insert({s[j],j});
    }*/
    return INF-5;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 2
2 Correct 2 ms 380 KB n = 2
3 Correct 2 ms 456 KB n = 2
4 Correct 2 ms 604 KB n = 2
5 Correct 2 ms 632 KB n = 2
6 Incorrect 2 ms 632 KB answer is not correct: 9223372036854775802 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 2
2 Correct 2 ms 380 KB n = 2
3 Correct 2 ms 456 KB n = 2
4 Correct 2 ms 604 KB n = 2
5 Correct 2 ms 632 KB n = 2
6 Incorrect 2 ms 632 KB answer is not correct: 9223372036854775802 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 200 ms 13868 KB n = 199999
2 Correct 210 ms 13920 KB n = 199991
3 Correct 183 ms 17720 KB n = 199993
4 Correct 174 ms 17720 KB n = 152076
5 Correct 97 ms 17720 KB n = 93249
6 Correct 200 ms 24976 KB n = 199910
7 Correct 209 ms 28068 KB n = 199999
8 Correct 195 ms 30840 KB n = 199997
9 Correct 236 ms 32068 KB n = 171294
10 Incorrect 131 ms 32800 KB answer is not correct: 1 instead of 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 2
2 Correct 2 ms 380 KB n = 2
3 Correct 2 ms 456 KB n = 2
4 Correct 2 ms 604 KB n = 2
5 Correct 2 ms 632 KB n = 2
6 Incorrect 2 ms 632 KB answer is not correct: 9223372036854775802 instead of 523688153
7 Halted 0 ms 0 KB -