# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
63175 | 2018-08-01T04:02:24 Z | koosaga(#1829) | Paths (BOI18_paths) | C++11 | 356 ms | 30448 KB |
#include<bits/stdc++.h> using namespace std; using pi = pair<int, int>; using lint = long long; const int MAXN = 100005; const int mod = 1e9 + 7; int n, m, k, a[MAXN]; vector<int> gph[MAXN]; lint dp[32][MAXN]; int main(){ scanf("%d %d %d",&n,&m,&k); for(int i=1; i<=n; i++){ scanf("%d",&a[i]); a[i]--; dp[1 << a[i]][i] = 1; } for(int i=0; i<m; i++){ int s, e; scanf("%d %d",&s,&e); gph[s].push_back(e); gph[e].push_back(s); } lint ret = 0; for(int i=2; i<(1<<k); i++){ if(i == (i & -i)) continue; for(int j=1; j<=n; j++){ if((i >> a[j]) & 1){ for(auto &k : gph[j]){ dp[i][j] += dp[i ^ (1 << a[j])][k]; } } ret += dp[i][j]; } } cout << ret << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 6 ms | 2860 KB | Output is correct |
3 | Correct | 5 ms | 2860 KB | Output is correct |
4 | Correct | 6 ms | 2900 KB | Output is correct |
5 | Correct | 6 ms | 2900 KB | Output is correct |
6 | Correct | 6 ms | 2980 KB | Output is correct |
7 | Correct | 6 ms | 3032 KB | Output is correct |
8 | Correct | 6 ms | 3032 KB | Output is correct |
9 | Correct | 5 ms | 3032 KB | Output is correct |
10 | Correct | 6 ms | 3032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 210 ms | 6856 KB | Output is correct |
2 | Correct | 126 ms | 6856 KB | Output is correct |
3 | Incorrect | 29 ms | 6856 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 6 ms | 2860 KB | Output is correct |
3 | Correct | 5 ms | 2860 KB | Output is correct |
4 | Correct | 6 ms | 2900 KB | Output is correct |
5 | Correct | 6 ms | 2900 KB | Output is correct |
6 | Correct | 6 ms | 2980 KB | Output is correct |
7 | Correct | 6 ms | 3032 KB | Output is correct |
8 | Correct | 6 ms | 3032 KB | Output is correct |
9 | Correct | 5 ms | 3032 KB | Output is correct |
10 | Correct | 6 ms | 3032 KB | Output is correct |
11 | Correct | 210 ms | 6856 KB | Output is correct |
12 | Correct | 126 ms | 6856 KB | Output is correct |
13 | Incorrect | 29 ms | 6856 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 6856 KB | Output is correct |
2 | Correct | 52 ms | 6856 KB | Output is correct |
3 | Correct | 44 ms | 6856 KB | Output is correct |
4 | Correct | 143 ms | 11504 KB | Output is correct |
5 | Correct | 110 ms | 12360 KB | Output is correct |
6 | Correct | 323 ms | 30440 KB | Output is correct |
7 | Correct | 39 ms | 30440 KB | Output is correct |
8 | Correct | 233 ms | 30440 KB | Output is correct |
9 | Correct | 146 ms | 30440 KB | Output is correct |
10 | Correct | 202 ms | 30440 KB | Output is correct |
11 | Correct | 215 ms | 30440 KB | Output is correct |
12 | Correct | 189 ms | 30440 KB | Output is correct |
13 | Correct | 161 ms | 30440 KB | Output is correct |
14 | Correct | 340 ms | 30448 KB | Output is correct |
15 | Correct | 356 ms | 30448 KB | Output is correct |
16 | Correct | 5 ms | 30448 KB | Output is correct |
17 | Correct | 5 ms | 30448 KB | Output is correct |
18 | Correct | 7 ms | 30448 KB | Output is correct |
19 | Correct | 5 ms | 30448 KB | Output is correct |
20 | Correct | 7 ms | 30448 KB | Output is correct |
21 | Correct | 6 ms | 30448 KB | Output is correct |
22 | Correct | 5 ms | 30448 KB | Output is correct |
23 | Correct | 7 ms | 30448 KB | Output is correct |
24 | Correct | 5 ms | 30448 KB | Output is correct |
25 | Correct | 6 ms | 30448 KB | Output is correct |