Submission #88846

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
888462018-12-09 08:38:06sailormoonTriumphal arch (POI13_luk)C++14
Compilation error
0 ms0 KiB
#include <map>
#include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
using namespace std;
vector<vector<int>> graph (300001); // size
set visited;
int canHandle(int v, int crs) {
int num_children = 0, need_crews = 0;
visited.insert(v);
for (int i = 0; i < graph[v].size(); i++) {
if (visited.find(graph[v][i]) == visited.end()) {
num_children++;
need_crews += canHandle(graph[v][i], crs);
}
}
return max(0, num_children + need_crews - crs);
}
int main() {
int n, a, b, start = 0, midpoint, end; // n -> towns, a -> from, b -> to
scanf("%d", &n);
end = n; // last point
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

luk.cpp:11:1: error: invalid use of template-name 'std::set' without an argument list
 set visited;
 ^~~
luk.cpp:11:1: note: class template argument deduction is only available with -std=c++1z or -std=gnu++1z
In file included from /usr/include/c++/7/set:61:0,
                 from luk.cpp:6:
/usr/include/c++/7/bits/stl_set.h:93:11: note: 'template<class _Key, class _Compare, class _Alloc> class std::set' declared here
     class set
           ^~~
luk.cpp: In function 'int canHandle(int, int)':
luk.cpp:16:5: error: 'visited' was not declared in this scope
     visited.insert(v);
     ^~~~~~~
luk.cpp:18:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < graph[v].size(); i++) {
                     ~~^~~~~~~~~~~~~~~~~
luk.cpp: In function 'int main()':
luk.cpp:46:9: error: 'visited' was not declared in this scope
         visited.clear();
         ^~~~~~~
luk.cpp:29:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
luk.cpp:34:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~~