# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
881645 | tsumondai | Cyberland (APIO23_cyberland) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
double solve(int N, int M, int K, int H, vi x, vi y, vi c, vi A) {//#include "cyberland.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
#define __TIME (1.0 * clock() / CLOCKS_PER_SEC)
using vi = vector<int>;
using ar = pair<double,int>;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
typedef pair<double, int> ar;
const int N = 1e5 + 5;
const int oo = 1e9, mod = 1e9 + 7;
int n, m, h;
double ans = 0;
bool vis[N];
double dis[N], dis2[N];
vector<ii> adj[N];
priority_queue<ar, vector<ar>, greater<ar>> pq;
void dijkstra(){
fill(vis,vis+n+1,0);
for(int i = 0; i < n; i++)
if(dis[i]<oo) pq.push({dis[i],i});
while(!pq.empty()){
auto tmp = pq.top(); pq.pop();
double D=tmp.fi; int a=tmp.se;
if(vis[a] || a==h) continue; vis[a]=1;
for(auto tmp : adj[a]) {
int b=tmp.fi, w=tmp.se;
if(dis[b]>dis[a]+w)
dis[b]=dis[a]+w, pq.push({dis[b],b});
}
}
ans = min(ans, dis[h]);
}
double solve(int N, int M, int K, int H, vi x, vi y, vi c, vi A) {
n = N, m = M, h = H, K = min(K, 67ll);
fill(dis, dis + n, oo); ans = oo;
for (int i = 0; i < n; i++) adj[i].clear();
for (int i = 0; i < m; i++)
adj[x[i]].push_back({y[i], c[i]}),
adj[y[i]].push_back({x[i], c[i]});
dis[0] = 0; dijkstra(); if (dis[h] >= oo) return -1;
for (int i = 0; i < n; i++)
if (dis[i] != oo) dis[i] = A[i] && i ? oo : 0;
for (int i = 0; i <= K; i++) {
dijkstra(); fill(dis2, dis2 + n, oo);
for (int j = 0; j < n; j++)
if (A[j] > 1) for (auto tmp : adj[j]) {
int u=tmp.fi, w=tmp.se;
dis2[u] = min(dis2[u], dis[j] / 2 + w);
}
for (int j = 0; j < n; j++) dis[j] = dis2[j];
}
return ans;
}
Compilation message (stderr)
cyberland.cpp:1:42: error: 'vi' has not been declared 1 | double solve(int N, int M, int K, int H, vi x, vi y, vi c, vi A) {//#include "cyberland.h" | ^~ cyberland.cpp:1:48: error: 'vi' has not been declared 1 | double solve(int N, int M, int K, int H, vi x, vi y, vi c, vi A) {//#include "cyberland.h" | ^~ cyberland.cpp:1:54: error: 'vi' has not been declared 1 | double solve(int N, int M, int K, int H, vi x, vi y, vi c, vi A) {//#include "cyberland.h" | ^~ cyberland.cpp:1:60: error: 'vi' has not been declared 1 | double solve(int N, int M, int K, int H, vi x, vi y, vi c, vi A) {//#include "cyberland.h" | ^~ In file included from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h: In function 'double solve(int, int, int, int, int, int, int, int)': /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:258:1: error: 'namespace' definition is not allowed here 258 | namespace std | ^~~~~~~~~ /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:280:1: error: 'namespace' definition is not allowed here 280 | namespace std | ^~~~~~~~~ /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:284:1: error: 'namespace' definition is not allowed here 284 | namespace __gnu_cxx | ^~~~~~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/assert.h:66:1: error: expected unqualified-id before string constant 66 | __BEGIN_DECLS | ^~~~~~~~~~~~~ /usr/include/ctype.h:28:1: error: expected unqualified-id before string constant 28 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:35, from cyberland.cpp:2: /usr/include/c++/10/cctype:62:1: error: 'namespace' definition is not allowed here 62 | namespace std | ^~~~~~~~~ /usr/include/c++/10/cctype:85:1: error: 'namespace' definition is not allowed here 85 | namespace std | ^~~~~~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/errno.h:34:1: error: expected unqualified-id before string constant 34 | __BEGIN_DECLS | ^~~~~~~~~~~~~ /usr/include/locale.h:31:1: error: expected unqualified-id before string constant 31 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:40, from cyberland.cpp:2: /usr/include/c++/10/clocale:51:1: error: 'namespace' definition is not allowed here 51 | namespace std | ^~~~~~~~~ In file included from /usr/include/c++/10/cmath:42, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from cyberland.cpp:2: /usr/include/c++/10/bits/cpp_type_traits.h:67:8: error: expected unqualified-id before string constant 67 | extern "C++" { | ^~~~~ In file included from /usr/include/c++/10/cmath:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from cyberland.cpp:2: /usr/include/c++/10/ext/type_traits.h:37:8: error: expected unqualified-id before string constant 37 | extern "C++" { | ^~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/math.h:34:1: error: expected unqualified-id before string constant 34 | __BEGIN_DECLS | ^~~~~~~~~~~~~ /usr/include/stdlib.h:33:1: error: expected unqualified-id before string constant 33 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/c++/10/cmath:47, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from cyberland.cpp:2: /usr/include/c++/10/bits/std_abs.h:46:8: error: expected unqualified-id before string constant 46 | extern "C++" | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from cyberland.cpp:2: /usr/include/c++/10/cmath:77:8: error: expected unqualified-id before string constant 77 | extern "C++" | ^~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/setjmp.h:27:1: error: expected unqualified-id before string constant 27 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:42, from cyberland.cpp:2: /usr/include/c++/10/csetjmp:55:1: error: 'namespace' definition is not allowed here 55 | namespace std | ^~~~~~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/signal.h:27:1: error: expected unqualified-id before string constant 27 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:43, from cyberland.cpp:2: /usr/include/c++/10/csignal:50:1: error: 'namespace' definition is not allowed here 50 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:44, from cyberland.cpp:2: /usr/include/c++/10/cstdarg:53:1: error: 'namespace' definition is not allowed here 53 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45, from cyberland.cpp:2: /usr/include/c++/10/cstddef:52:8: error: expected unqualified-id before string constant 52 | extern "C++" | ^~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/stdio.h:29:1: error: expected unqualified-id before string constant 29 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:46, from cyberland.cpp:2: /usr/include/c++/10/cstdio:96:1: error: 'namespace' definition is not allowed here 96 | namespace std | ^~~~~~~~~ /usr/include/c++/10/cstdio:157:1: error: 'namespace' definition is not allowed here 157 | namespace __gnu_cxx | ^~~~~~~~~ /usr/include/c++/10/cstdio:183:1: error: 'namespace' definition is not allowed here 183 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:47, from cyberland.cpp:2: /usr/include/c++/10/cstdlib:121:8: error: expected unqualified-id before string constant 121 | extern "C++" | ^~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/string.h:28:1: error: expected unqualified-id before string constant 28 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:48, from cyberland.cpp:2: /usr/include/c++/10/cstring:71:8: error: expected unqualified-id before string constant 71 | extern "C++" | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/bits/time.h:73, from /usr/include/time.h:33, from /usr/include/c++/10/ctime:42, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:49, from cyberland.cpp:2: /usr/include/x86_64-linux-gnu/bits/timex.h:37:18: error: field 'time' has incomplete type 'solve(int, int, int, int, int, int, int, int)::timeval' 37 | struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ | ^~~~ /usr/include/x86_64-linux-gnu/bits/timex.h:37:10: note: forward declaration of 'struct solve(int, int, int, int, int, int, int, int)::timeval' 37 | struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ | ^~~~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/x86_64-linux-gnu/bits/time.h:75:1: error: expected unqualified-id before string constant 75 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/time.h:48, from /usr/include/c++/10/ctime:42, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:49, from cyberland.cpp:2: /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h:10:21: error: field 'it_interval' has incomplete type 'solve(int, int, int, int, int, int, int, int)::timespec' 10 | struct timespec it_interval; | ^~~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h:10:12: note: forward declaration of 'struct solve(int, int, int, int, int, int, int, int)::timespec' 10 | struct timespec it_interval; | ^~~~~~~~ /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h:11:21: error: field 'it_value' has incomplete type 'solve(int, int, int, int, int, int, int, int)::timespec' 11 | struct timespec it_value; | ^~~~~~~~ /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h:10:12: note: forward declaration of 'struct solve(int, int, int, int, int, int, int, int)::timespec' 10 | struct timespec it_interval; | ^~~~~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/time.h:68:1: error: expected unqualified-id before string constant 68 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:49, from cyberland.cpp:2: /usr/include/c++/10/ctime:58:1: error: 'namespace' definition is not allowed here 58 | namespace std | ^~~~~~~~~ /usr/include/c++/10/ctime:77:1: error: 'namespace' definition is not allowed here 77 | namespace std | ^~~~~~~~~ In file included from /usr/include/wchar.h:42, from /usr/include/c++/10/cwchar:44, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:50, from cyberland.cpp:2: /usr/include/x86_64-linux-gnu/bits/types/mbstate_t.h:6:9: error: '__mbstate_t' does not name a type 6 | typedef __mbstate_t mbstate_t; | ^~~~~~~~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/wchar.h:79:1: error: expected unqualified-id before string constant 79 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:50, from cyberland.cpp:2: /usr/include/c++/10/cwchar:62:1: error: 'namespace' definition is not allowed here 62 | namespace std | ^~~~~~~~~ /usr/include/c++/10/cwchar:135:8: error: expected unqualified-id before string constant 135 | extern "C++" | ^~~~~ /usr/include/c++/10/cwchar:244:1: error: 'namespace' definition is not allowed here 244 | namespace __gnu_cxx | ^~~~~~~~~ /usr/include/c++/10/cwchar:265:1: error: 'namespace' definition is not allowed here 265 | namespace std | ^~~~~~~~~ /usr/include/c++/10/cwchar:280:1: error: 'namespace' definition is not allowed here 280 | namespace std | ^~~~~~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/x86_64-linux-gnu/bits/wctype-wchar.h:87:1: error: expected unqualified-id before string constant 87 | __BEGIN_DECLS | ^~~~~~~~~~~~~ /usr/include/wctype.h:44:1: error: expected unqualified-id before string constant 44 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:51, from cyberland.cpp:2: /usr/include/c++/10/cwctype:80:1: error: 'namespace' definition is not allowed here 80 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cyberland.cpp:2: /usr/include/c++/10/ccomplex:38:8: error: expected unqualified-id before string constant 38 | extern "C++" { | ^~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/x86_64-linux-gnu/bits/fenv.h:120:1: error: expected unqualified-id before string constant 120 | __BEGIN_DECLS | ^~~~~~~~~~~~~ /usr/include/fenv.h:66:1: error: expected unqualified-id before string constant 66 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/c++/10/cfenv:41, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:55, from cyberland.cpp:2: /usr/include/c++/10/fenv.h:55:1: error: 'namespace' definition is not allowed here 55 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:55, from cyberland.cpp:2: /usr/include/c++/10/cfenv:58:1: error: 'namespace' definition is not allowed here 58 | namespace std | ^~~~~~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/inttypes.h:266:1: error: expected unqualified-id before string constant 266 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:56, from cyberland.cpp:2: /usr/include/c++/10/cinttypes:55:1: error: 'namespace' definition is not allowed here 55 | namespace std | ^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:60, from cyberland.cpp:2: /usr/include/c++/10/ctgmath:38:8: error: expected unqualified-id before string constant 38 | extern "C++" { | ^~~~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/uchar.h:41:1: error: expected unqualified-id before string constant 41 | __BEGIN_DECLS | ^~~~~~~~~~~~~ In file included from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from cyberland.cpp:2: /usr/include/c++/10/cuchar:61:15: error: expected '=' before '__attribute__' 61 | namespace std _GLIBCXX_VISIBILITY(default) | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/cuchar:61:15: error: expected identifier before '__attribute__' In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:61, from cyberland.cpp:2: /usr/include/c++/10/cuchar:61:14: error: expected ';' before '__attribute__' 61 | namespace std _GLIBCXX_VISIBILITY(default) |