Submission #73144

# Submission time Handle Problem Language Result Execution time Memory
73144 2018-08-28T01:01:17 Z Kmcode Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
658 ms 28684 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(sum<0){
			return 111;
		}
	}
	for(auto it:mp){
		if(it.second!=0){
			return 222;
		}
	}
    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 2 ms 248 KB answer is not correct: 222 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB answer is not correct: 222 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 658 ms 28684 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB answer is not correct: 222 instead of 0
2 Halted 0 ms 0 KB -