Submission #24061

# Submission time Handle Problem Language Result Execution time Memory
24061 2017-05-30T05:05:57 Z gs14004 Roller Coaster Railroad (IOI16_railroad) C++11
0 / 100
656 ms 30140 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 < 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 553 ms 30132 KB n = 199999
2 Correct 656 ms 30132 KB n = 199991
3 Correct 589 ms 30132 KB n = 199993
4 Correct 423 ms 24868 KB n = 152076
5 Correct 229 ms 15392 KB n = 93249
6 Correct 463 ms 26720 KB n = 199910
7 Correct 486 ms 29720 KB n = 199999
8 Correct 406 ms 26840 KB n = 199997
9 Correct 453 ms 26984 KB n = 171294
10 Correct 339 ms 23664 KB n = 140872
11 Correct 476 ms 26980 KB n = 199886
12 Correct 406 ms 29844 KB n = 199996
13 Correct 376 ms 27564 KB n = 200000
14 Correct 403 ms 29752 KB n = 199998
15 Correct 406 ms 29444 KB n = 200000
16 Correct 386 ms 30056 KB n = 199998
17 Correct 499 ms 30136 KB n = 200000
18 Correct 409 ms 29036 KB n = 190000
19 Correct 403 ms 27700 KB n = 177777
20 Correct 186 ms 16124 KB n = 100000
21 Correct 513 ms 30136 KB n = 200000
22 Incorrect 539 ms 30140 KB answer is not correct: 0 instead of 1
23 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 -