Submission #24058

# Submission time Handle Problem Language Result Execution time Memory
24058 2017-05-30T05:01:38 Z gs14004 Roller Coaster Railroad (IOI16_railroad) C++11
0 / 100
489 ms 23904 KB
#include "railroad.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;

// s[i] -> t[i]
// inf amount of i -> i+1, if needed
// outdegree = -1
// indegree = 1
// ok if eulerable in every comp.

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]]++;
  	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:18:18: 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:19:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i=1; i<v.size(); i++){
                  ^
railroad.cpp:17:9: 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: 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 469 ms 23904 KB n = 199999
2 Incorrect 489 ms 23904 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 -