Submission #24060

# Submission time Handle Problem Language Result Execution time Memory
24060 2017-05-30T05:03:55 Z gs14004 Roller Coaster Railroad (IOI16_railroad) C++11
0 / 100
599 ms 30132 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<pi> 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(pi(i.first, i.second));
	bool shortage = 0;
	for(int i=1; i<v.size(); i++) v[i].second += v[i-1].second;
	for(int i=1; i<v.size(); i++){
		if(v[i-1].second < 0 && v[i].second + v[i-1].second < 0) return 1;
	}
	return 0;
}

Compilation message

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:13:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1; i<v.size(); i++) v[i].second += v[i-1].second;
                ^
railroad.cpp:14:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1; i<v.size(); i++){
                ^
railroad.cpp:12:7: warning: unused variable 'shortage' [-Wunused-variable]
  bool shortage = 0;
       ^
# 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: 1 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: 1 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 523 ms 30132 KB n = 199999
2 Correct 599 ms 30132 KB n = 199991
3 Correct 529 ms 30132 KB n = 199993
4 Correct 449 ms 24868 KB n = 152076
5 Correct 139 ms 15392 KB n = 93249
6 Correct 376 ms 26720 KB n = 199910
7 Correct 429 ms 29720 KB n = 199999
8 Correct 449 ms 26840 KB n = 199997
9 Correct 486 ms 26984 KB n = 171294
10 Incorrect 376 ms 23664 KB answer is not correct: 1 instead of 0
11 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: 1 instead of 523688153
7 Halted 0 ms 0 KB -