# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975339 | 2024-05-04T20:33:13 Z | Isam | Paths (BOI18_paths) | C++17 | 3000 ms | 11528 KB |
#include<bits/stdc++.h> using namespace std; #define eb emplace_back constexpr int sz = 2e5 + 5; int n, m, k, ans, c[sz]; vector<int> g[sz]; array<bool, 5> vis; inline void dfs(int node){ vis[c[node]] = 1; for(auto &to : g[node]){ if(vis[c[to]]) continue; ++ans; dfs(to); } vis[c[node]] = 0; return; } signed main(){ cin >> n >> m >> k; for(register int i = 1; i <= n; ++i){ cin >> c[i]; } for(register int i = 1, u, v; i <= m; ++i){ cin >> u >> v; g[u].eb(v), g[v].eb(u); } for(register int i = 1; i <= n; ++i){ dfs(i); } cout << ans << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4952 KB | Output is correct |
2 | Correct | 2 ms | 4952 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 1 ms | 4956 KB | Output is correct |
5 | Correct | 1 ms | 4956 KB | Output is correct |
6 | Correct | 1 ms | 4952 KB | Output is correct |
7 | Correct | 2 ms | 4956 KB | Output is correct |
8 | Correct | 2 ms | 4952 KB | Output is correct |
9 | Correct | 2 ms | 4956 KB | Output is correct |
10 | Correct | 2 ms | 4956 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3058 ms | 11528 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4952 KB | Output is correct |
2 | Correct | 2 ms | 4952 KB | Output is correct |
3 | Correct | 2 ms | 4956 KB | Output is correct |
4 | Correct | 1 ms | 4956 KB | Output is correct |
5 | Correct | 1 ms | 4956 KB | Output is correct |
6 | Correct | 1 ms | 4952 KB | Output is correct |
7 | Correct | 2 ms | 4956 KB | Output is correct |
8 | Correct | 2 ms | 4952 KB | Output is correct |
9 | Correct | 2 ms | 4956 KB | Output is correct |
10 | Correct | 2 ms | 4956 KB | Output is correct |
11 | Execution timed out | 3058 ms | 11528 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4956 KB | Output is correct |
2 | Execution timed out | 3076 ms | 6852 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |