# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
881085 |
2023-11-30T14:39:26 Z |
OAleksa |
Paths (BOI18_paths) |
C++14 |
|
3000 ms |
12624 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
const int maxn = 1e5 + 69;
int n, m, k, a[maxn], ans;
vector<int> g[maxn];
void dfs(int v, int nmask) {
ans += (nmask == 0);
for (auto u : g[v]) {
if (nmask & (1 << a[u]))
dfs(u, nmask ^ (1 << a[u]));
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt = 1;
//cin >> tt;
while (tt--) {
cin >> n >> m >> k;
for (int i = 1;i <= n;i++) {
cin >> a[i];
--a[i];
}
for (int i = 1;i <= m;i++) {
int a, b;
cin >> a >> b;
g[a].push_back(b);
g[b].push_back(a);
}
for (int mask = 1;mask < (1 << k);mask++) {
for (int i = 1;i <= n;i++) {
if (mask & (1 << a[i]))
dfs(i, mask ^ (1 << a[i]));
}
}
ans -= n;
cout << ans;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2648 KB |
Output is correct |
3 |
Correct |
1 ms |
2648 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
5 |
Correct |
2 ms |
2804 KB |
Output is correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
2 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2184 ms |
12624 KB |
Output is correct |
2 |
Execution timed out |
3038 ms |
12160 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2648 KB |
Output is correct |
3 |
Correct |
1 ms |
2648 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
5 |
Correct |
2 ms |
2804 KB |
Output is correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
2 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2664 KB |
Output is correct |
11 |
Correct |
2184 ms |
12624 KB |
Output is correct |
12 |
Execution timed out |
3038 ms |
12160 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Execution timed out |
3035 ms |
5724 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |