Submission #1317210

#TimeUsernameProblemLanguageResultExecution timeMemory
1317210huseynahmadli2010Dreaming (IOI13_dreaming)C++20
Compilation error
0 ms0 KiB
#include "dreaming.h" #define int long long; const int sz=1e6+5; vector<pair<int,int>> graph[sz]; bool visited[sz]; int sum=0; void dfs(int v) { visited[v]=true; for(auto &[to,w] : graph[v]) { if(!visited[to]) { dfs(to); sum+=w; } } } int travelTime(int n,int m,int l,int a[],int b[],int t[]) { for(int i=0;i<m;i++) { graph[a[i]].push_back({b[i],t[i]}); graph[b[i]].push_back({a[i],t[i]}); } vector<int> res; for(int i=0;i<n;i++) { if(!visited[i]) { dfs(i); res.push_back(sum); sum=0; } } if(res.size()==1) return res[0]; sort(res.rbegin(),res.rend()); return (res[0]+res[1]+l); }

Compilation message (stderr)

dreaming.cpp:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
dreaming.cpp:5:7: note: in expansion of macro 'int'
    5 | const int sz=1e6+5;
      |       ^~~
dreaming.cpp:5:11: error: 'sz' does not name a type
    5 | const int sz=1e6+5;
      |           ^~
dreaming.cpp:7:8: error: 'pair' was not declared in this scope
    7 | vector<pair<int,int>> graph[sz];
      |        ^~~~
dreaming.cpp:7:8: error: 'pair' was not declared in this scope
dreaming.cpp:7:8: error: 'pair' was not declared in this scope
dreaming.cpp:7:8: error: 'pair' was not declared in this scope
dreaming.cpp:7:8: error: 'pair' was not declared in this scope
dreaming.cpp:7:8: error: 'pair' was not declared in this scope
dreaming.cpp:7:8: error: 'pair' was not declared in this scope
dreaming.cpp:7:8: error: 'pair' was not declared in this scope
dreaming.cpp:7:8: error: 'pair' was not declared in this scope
dreaming.cpp:7:1: error: 'vector' does not name a type
    7 | vector<pair<int,int>> graph[sz];
      | ^~~~~~
dreaming.cpp:7:16: error: expected unqualified-id before ',' token
    7 | vector<pair<int,int>> graph[sz];
      |                ^
dreaming.cpp:3:13: error: expected unqualified-id before 'long'
    3 | #define int long long;
      |             ^~~~
dreaming.cpp:7:17: note: in expansion of macro 'int'
    7 | vector<pair<int,int>> graph[sz];
      |                 ^~~
dreaming.cpp:7:20: error: expected unqualified-id before '>>' token
    7 | vector<pair<int,int>> graph[sz];
      |                    ^~
dreaming.cpp:9:14: error: 'sz' was not declared in this scope
    9 | bool visited[sz];
      |              ^~
dreaming.cpp:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
dreaming.cpp:11:1: note: in expansion of macro 'int'
   11 | int sum=0;
      | ^~~
dreaming.cpp:11:5: error: 'sum' does not name a type
   11 | int sum=0;
      |     ^~~
dreaming.cpp:3:22: error: expected ')' before ';' token
    3 | #define int long long;
      |                      ^
dreaming.cpp:13:10: note: in expansion of macro 'int'
   13 | void dfs(int v)
      |          ^~~
dreaming.cpp:13:9: note: to match this '('
   13 | void dfs(int v)
      |         ^
dreaming.cpp:13:14: error: 'v' does not name a type
   13 | void dfs(int v)
      |              ^
dreaming.cpp:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
dreaming.cpp:28:1: note: in expansion of macro 'int'
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      | ^~~
dreaming.cpp:3:22: error: expected ')' before ';' token
    3 | #define int long long;
      |                      ^
dreaming.cpp:28:16: note: in expansion of macro 'int'
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      |                ^~~
dreaming.cpp:28:15: note: to match this '('
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      |               ^
dreaming.cpp:3:22: error: expected constructor, destructor, or type conversion before ';' token
    3 | #define int long long;
      |                      ^
dreaming.cpp:28:16: note: in expansion of macro 'int'
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      |                ^~~
dreaming.cpp:28:20: error: 'n' does not name a type
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      |                    ^
dreaming.cpp:28:26: error: 'm' does not name a type
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      |                          ^
dreaming.cpp:28:32: error: 'l' does not name a type
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      |                                ^
dreaming.cpp:28:38: error: 'a' does not name a type
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      |                                      ^
dreaming.cpp:28:46: error: 'b' does not name a type
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      |                                              ^
dreaming.cpp:28:54: error: 't' does not name a type
   28 | int travelTime(int n,int m,int l,int a[],int b[],int t[])
      |                                                      ^