# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
63183 | 2018-08-01T04:30:45 Z | 김현수(#2143) | Paths (BOI18_paths) | C++11 | 668 ms | 56028 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 300005; ll n, m, k, a[N], dt[1<<5][N], ans; vector<ll> adj[N]; int main() { scanf("%lld%lld%lld",&n,&m,&k); for(ll i=1;i<=n;i++) { scanf("%lld",&a[i]); a[i]--; } for(ll i=1;i<=m;i++) { ll A, B; scanf("%lld%lld",&A,&B); adj[A].push_back(B); adj[B].push_back(A); } for(ll x=1;x<(1<<k);x++) { for(ll i=1;i<=n;i++) { ll j = (1<<a[i]); if(!(j & x)) continue; if(j == x) dt[x][i] = 1; for(auto &T : adj[i]) { dt[x][i] += dt[x-j][T]; } ans += dt[x][i]; } } printf("%lld\n",ans-n); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 7548 KB | Output is correct |
2 | Correct | 11 ms | 7656 KB | Output is correct |
3 | Correct | 8 ms | 7656 KB | Output is correct |
4 | Correct | 8 ms | 7656 KB | Output is correct |
5 | Correct | 8 ms | 7656 KB | Output is correct |
6 | Correct | 11 ms | 7756 KB | Output is correct |
7 | Correct | 10 ms | 7772 KB | Output is correct |
8 | Correct | 10 ms | 7772 KB | Output is correct |
9 | Correct | 8 ms | 7772 KB | Output is correct |
10 | Correct | 9 ms | 7772 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 120 ms | 15216 KB | Output is correct |
2 | Correct | 90 ms | 15216 KB | Output is correct |
3 | Correct | 428 ms | 37112 KB | Output is correct |
4 | Correct | 253 ms | 37112 KB | Output is correct |
5 | Correct | 206 ms | 37112 KB | Output is correct |
6 | Correct | 379 ms | 37112 KB | Output is correct |
7 | Correct | 534 ms | 37112 KB | Output is correct |
8 | Correct | 475 ms | 37628 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 7548 KB | Output is correct |
2 | Correct | 11 ms | 7656 KB | Output is correct |
3 | Correct | 8 ms | 7656 KB | Output is correct |
4 | Correct | 8 ms | 7656 KB | Output is correct |
5 | Correct | 8 ms | 7656 KB | Output is correct |
6 | Correct | 11 ms | 7756 KB | Output is correct |
7 | Correct | 10 ms | 7772 KB | Output is correct |
8 | Correct | 10 ms | 7772 KB | Output is correct |
9 | Correct | 8 ms | 7772 KB | Output is correct |
10 | Correct | 9 ms | 7772 KB | Output is correct |
11 | Correct | 120 ms | 15216 KB | Output is correct |
12 | Correct | 90 ms | 15216 KB | Output is correct |
13 | Correct | 428 ms | 37112 KB | Output is correct |
14 | Correct | 253 ms | 37112 KB | Output is correct |
15 | Correct | 206 ms | 37112 KB | Output is correct |
16 | Correct | 379 ms | 37112 KB | Output is correct |
17 | Correct | 534 ms | 37112 KB | Output is correct |
18 | Correct | 475 ms | 37628 KB | Output is correct |
19 | Correct | 145 ms | 37628 KB | Output is correct |
20 | Correct | 103 ms | 37628 KB | Output is correct |
21 | Correct | 476 ms | 37628 KB | Output is correct |
22 | Correct | 212 ms | 37628 KB | Output is correct |
23 | Correct | 203 ms | 37628 KB | Output is correct |
24 | Correct | 320 ms | 37628 KB | Output is correct |
25 | Correct | 515 ms | 37628 KB | Output is correct |
26 | Correct | 448 ms | 37628 KB | Output is correct |
27 | Correct | 151 ms | 37628 KB | Output is correct |
28 | Correct | 176 ms | 37628 KB | Output is correct |
29 | Correct | 665 ms | 56028 KB | Output is correct |
30 | Correct | 448 ms | 56028 KB | Output is correct |
31 | Correct | 420 ms | 56028 KB | Output is correct |
32 | Correct | 668 ms | 56028 KB | Output is correct |
33 | Correct | 9 ms | 56028 KB | Output is correct |
34 | Correct | 11 ms | 56028 KB | Output is correct |
35 | Correct | 10 ms | 56028 KB | Output is correct |
36 | Correct | 10 ms | 56028 KB | Output is correct |
37 | Correct | 9 ms | 56028 KB | Output is correct |
38 | Correct | 10 ms | 56028 KB | Output is correct |
39 | Correct | 10 ms | 56028 KB | Output is correct |
40 | Correct | 10 ms | 56028 KB | Output is correct |
41 | Correct | 10 ms | 56028 KB | Output is correct |
42 | Correct | 10 ms | 56028 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 56028 KB | Output is correct |
2 | Correct | 45 ms | 56028 KB | Output is correct |
3 | Correct | 47 ms | 56028 KB | Output is correct |
4 | Correct | 149 ms | 56028 KB | Output is correct |
5 | Correct | 86 ms | 56028 KB | Output is correct |
6 | Correct | 286 ms | 56028 KB | Output is correct |
7 | Correct | 37 ms | 56028 KB | Output is correct |
8 | Correct | 162 ms | 56028 KB | Output is correct |
9 | Correct | 147 ms | 56028 KB | Output is correct |
10 | Correct | 193 ms | 56028 KB | Output is correct |
11 | Correct | 143 ms | 56028 KB | Output is correct |
12 | Correct | 128 ms | 56028 KB | Output is correct |
13 | Correct | 150 ms | 56028 KB | Output is correct |
14 | Correct | 297 ms | 56028 KB | Output is correct |
15 | Correct | 292 ms | 56028 KB | Output is correct |
16 | Correct | 9 ms | 56028 KB | Output is correct |
17 | Correct | 9 ms | 56028 KB | Output is correct |
18 | Correct | 9 ms | 56028 KB | Output is correct |
19 | Correct | 9 ms | 56028 KB | Output is correct |
20 | Correct | 8 ms | 56028 KB | Output is correct |
21 | Correct | 10 ms | 56028 KB | Output is correct |
22 | Correct | 9 ms | 56028 KB | Output is correct |
23 | Correct | 11 ms | 56028 KB | Output is correct |
24 | Correct | 10 ms | 56028 KB | Output is correct |
25 | Correct | 10 ms | 56028 KB | Output is correct |