Submission #73141

# Submission time Handle Problem Language Result Execution time Memory
73141 2018-08-28T00:49:15 Z Kmcode Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
568 ms 28580 KB
#include<bits/stdc++.h>
using namespace std;

//#include "railroad.h"

map<int,long long int> mp;


long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
	t.push_back(-1);
	s.push_back(INT_MAX-3);
    for(int i=0;i<s.size();i++){
		mp[s[i]]++;
		mp[t[i]]--;
	}
	long long int sum=0;
	for(auto it:mp){
		long long int add=sum;
		sum-=it.second;
		it.second+=add;
		it.second-=sum;
		if(it.second<0){
			return 1;
		}
	}
	for(auto it:mp){
		if(it.second&1){
			return 1;
		}
	}
    return 0;
}

Compilation message

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:12:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++){
                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 568 ms 28580 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -