답안 #869372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
869372 2023-11-04T08:31:50 Z 12345678 Paths (BOI18_paths) C++17
23 / 100
3000 ms 13980 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=3e5+5;
int n, m, k, u, v, c[nx];
vector<int> d[nx];
long long ans;

void dfs(int u, int s)
{
    ans++;
    for (auto v:d[u]) if (!(s&(1<<c[v]))) dfs(v, s+(1<<c[v]));
}

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>m>>k;
    for (int i=1; i<=n; i++) cin>>c[i];
    for (int i=0; i<m; i++) cin>>u>>v, d[u].push_back(v), d[v].push_back(u);
    for (int i=1; i<=n; i++) dfs(i, 1<<c[i]);
    cout<<ans-n;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7260 KB Output is correct
2 Correct 2 ms 7260 KB Output is correct
3 Correct 2 ms 7256 KB Output is correct
4 Correct 2 ms 7512 KB Output is correct
5 Correct 2 ms 7260 KB Output is correct
6 Correct 2 ms 7516 KB Output is correct
7 Correct 2 ms 7260 KB Output is correct
8 Correct 2 ms 7516 KB Output is correct
9 Correct 2 ms 7256 KB Output is correct
10 Correct 2 ms 7256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1897 ms 13980 KB Output is correct
2 Execution timed out 3009 ms 13136 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7260 KB Output is correct
2 Correct 2 ms 7260 KB Output is correct
3 Correct 2 ms 7256 KB Output is correct
4 Correct 2 ms 7512 KB Output is correct
5 Correct 2 ms 7260 KB Output is correct
6 Correct 2 ms 7516 KB Output is correct
7 Correct 2 ms 7260 KB Output is correct
8 Correct 2 ms 7516 KB Output is correct
9 Correct 2 ms 7256 KB Output is correct
10 Correct 2 ms 7256 KB Output is correct
11 Correct 1897 ms 13980 KB Output is correct
12 Execution timed out 3009 ms 13136 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7260 KB Output is correct
2 Execution timed out 3069 ms 9316 KB Time limit exceeded
3 Halted 0 ms 0 KB -