Check
Check
Check
h>
using namespace std;
struct game {
int start;
int end;
string type;
};
// @PLACEMENTLELO
bool solve(vector<int>& dieRolls, unordered_map<int, int>& board, int finalPos) {
int position = 1;
for (int roll : dieRolls) {
if (position + roll <= 100) {
position += roll;
}
while (board.find(position) != board.end()) {
position = board[position];
}
}
if (board.find(position) != board.end()) {
return false;
}
return position == finalPos;
}
// @PLACEMENTLELO
void solve()
{
int N;
cin >> N;
vector<game> snakesLadders;
unordered_map<int, int> board;
for (int i = 0; i < N; ++i) {
int start, end;
cin >> start >> end;
game sl;
sl.start = start;
sl.end = end;
if (start > end) {
sl.type = "Snake";
} else {
sl.type = "Ladder";
}
snakesLadders.push_back(sl);
board[start] = end;
}
// @PLACEMENTLELO
vector<int> remainingInput;
int num;
while (cin >> num) {
remainingInput.push_back(num);
}
if (remainingInput.empty()) {
cout << "Not reachable";
return;
}
int finalPos = remainingInput.back();
remainingInput.pop_back();
vector<int> dieRolls = remainingInput;