Submission #1085256

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10852562024-09-07 19:00:56IzzyBosses (BOI16_bosses)C++14
0 / 100
0 ms348 KiB
#include <vector>
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
int n;
map<int, vector<int>> arr;
int test(int start) {
vector<bool> visited(n, false);
vector<vector<int>> levels = {{start}};
int lvl = 0;
int pos = 0;
int salary = 0;
visited[start] = true;
while (lvl < int(levels.size())) {
start = levels[lvl][pos];
auto it = arr.find(start);
if (it != arr.end()) {
for (int i: arr[start]) {
if (!visited[i]) {
visited[i] = true;
if (int(levels.size()) > lvl + 1) {
levels[lvl + 1].push_back(i);
}
else {
levels.push_back({i});
}
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

bosses.cpp: In function 'int test(int)':
bosses.cpp:9:34: warning: control reaches end of non-void function [-Wreturn-type]
    9 |     vector<bool> visited(n, false);
      |                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...