답안 #73000

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
73000 2018-08-27T13:01:13 Z Kmcode Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
146 ms 7960 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 0;
	    return ok;
	}
	

Compilation message

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:19:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<v.size();i++){
               ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 380 KB n = 2
2 Correct 2 ms 380 KB n = 2
3 Correct 3 ms 380 KB n = 2
4 Correct 3 ms 540 KB n = 2
5 Correct 2 ms 576 KB n = 2
6 Incorrect 3 ms 576 KB answer is not correct: 0 instead of 523688153
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 380 KB n = 2
2 Correct 2 ms 380 KB n = 2
3 Correct 3 ms 380 KB n = 2
4 Correct 3 ms 540 KB n = 2
5 Correct 2 ms 576 KB n = 2
6 Incorrect 3 ms 576 KB answer is not correct: 0 instead of 523688153
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 142 ms 7856 KB n = 199999
2 Incorrect 146 ms 7960 KB answer is not correct: 0 instead of 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 380 KB n = 2
2 Correct 2 ms 380 KB n = 2
3 Correct 3 ms 380 KB n = 2
4 Correct 3 ms 540 KB n = 2
5 Correct 2 ms 576 KB n = 2
6 Incorrect 3 ms 576 KB answer is not correct: 0 instead of 523688153
7 Halted 0 ms 0 KB -