Submission #24386

# Submission time Handle Problem Language Result Execution time Memory
24386 2017-06-06T13:00:21 Z gs14004 Roller Coaster Railroad (IOI16_railroad) C++11
0 / 100
549 ms 27060 KB
#include "railroad.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;

map<int, int> mp;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
	vector<int> v;
	int n = (int) s.size();
	for(int i=0; i<n; i++){
		mp[s[i]]++;
		mp[t[i]]--;
	}
	for(auto &i : mp) v.push_back(i.second);
	int curBef = 1;
	for(int i=0; i<v.size(); i++){
		if(v[i] > 0){
			curBef -= v[i];
			if(curBef < 0) return 0;
		}
		curBef -= v[i];
	}
	return 0;
}

Compilation message

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:16:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<v.size(); i++){
                ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2024 KB n = 2
2 Correct 0 ms 2024 KB n = 2
3 Correct 0 ms 2024 KB n = 2
4 Correct 0 ms 2024 KB n = 2
5 Correct 0 ms 2024 KB n = 2
6 Incorrect 0 ms 2024 KB answer is not correct: 0 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2024 KB n = 2
2 Correct 0 ms 2024 KB n = 2
3 Correct 0 ms 2024 KB n = 2
4 Correct 0 ms 2024 KB n = 2
5 Correct 0 ms 2024 KB n = 2
6 Incorrect 0 ms 2024 KB answer is not correct: 0 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 549 ms 27060 KB n = 199999
2 Incorrect 483 ms 27060 KB answer is not correct: 0 instead of 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2024 KB n = 2
2 Correct 0 ms 2024 KB n = 2
3 Correct 0 ms 2024 KB n = 2
4 Correct 0 ms 2024 KB n = 2
5 Correct 0 ms 2024 KB n = 2
6 Incorrect 0 ms 2024 KB answer is not correct: 0 instead of 523688153
7 Halted 0 ms 0 KB -