# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
231319 | 2020-05-13T11:14:07 Z | DodgeBallMan | Paths (BOI18_paths) | C++14 | 155 ms | 40480 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n, m, k, col[N]; long long dp[N][40], ans; vector<int> g[N]; long long solve( int u, int bit ) { long long &ret = dp[u][bit]; if( ret != -1 ) return ret; ret = 1; for( int v : g[u] ) if( ( 1<<col[v] ) & bit ) ret += solve( v, bit - ( 1<<col[v] ) ); return ret; } int main() { memset( dp, -1, sizeof dp ); scanf("%d %d %d",&n,&m,&k); for( int i = 1 ; i <= n ; i++ ) { scanf("%d",&col[i]); col[i]--; } for( int i = 1, a, b ; i <= m ; i++ ) { scanf("%d %d",&a,&b); g[a].emplace_back( b ), g[b].emplace_back( a ); } for( int i = 1 ; i <= n ; i++ ) ans += solve( i, (1<<k)-(1<<col[i])-1 ) - 1; printf("%lld",ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 34176 KB | Output is correct |
2 | Correct | 20 ms | 34048 KB | Output is correct |
3 | Correct | 20 ms | 34048 KB | Output is correct |
4 | Correct | 21 ms | 34048 KB | Output is correct |
5 | Correct | 20 ms | 34048 KB | Output is correct |
6 | Correct | 20 ms | 34048 KB | Output is correct |
7 | Correct | 23 ms | 34048 KB | Output is correct |
8 | Correct | 20 ms | 34040 KB | Output is correct |
9 | Correct | 21 ms | 34048 KB | Output is correct |
10 | Correct | 26 ms | 34048 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 125 ms | 40480 KB | Output is correct |
2 | Correct | 109 ms | 39800 KB | Output is correct |
3 | Incorrect | 30 ms | 34816 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 34176 KB | Output is correct |
2 | Correct | 20 ms | 34048 KB | Output is correct |
3 | Correct | 20 ms | 34048 KB | Output is correct |
4 | Correct | 21 ms | 34048 KB | Output is correct |
5 | Correct | 20 ms | 34048 KB | Output is correct |
6 | Correct | 20 ms | 34048 KB | Output is correct |
7 | Correct | 23 ms | 34048 KB | Output is correct |
8 | Correct | 20 ms | 34040 KB | Output is correct |
9 | Correct | 21 ms | 34048 KB | Output is correct |
10 | Correct | 26 ms | 34048 KB | Output is correct |
11 | Correct | 125 ms | 40480 KB | Output is correct |
12 | Correct | 109 ms | 39800 KB | Output is correct |
13 | Incorrect | 30 ms | 34816 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 33920 KB | Output is correct |
2 | Correct | 64 ms | 35832 KB | Output is correct |
3 | Correct | 49 ms | 35704 KB | Output is correct |
4 | Correct | 116 ms | 38520 KB | Output is correct |
5 | Correct | 90 ms | 39320 KB | Output is correct |
6 | Correct | 145 ms | 38648 KB | Output is correct |
7 | Correct | 58 ms | 35832 KB | Output is correct |
8 | Correct | 125 ms | 38552 KB | Output is correct |
9 | Correct | 105 ms | 39280 KB | Output is correct |
10 | Correct | 125 ms | 39388 KB | Output is correct |
11 | Correct | 123 ms | 37084 KB | Output is correct |
12 | Correct | 91 ms | 38256 KB | Output is correct |
13 | Correct | 119 ms | 37372 KB | Output is correct |
14 | Correct | 155 ms | 38520 KB | Output is correct |
15 | Correct | 119 ms | 38648 KB | Output is correct |
16 | Correct | 20 ms | 34048 KB | Output is correct |
17 | Correct | 21 ms | 34048 KB | Output is correct |
18 | Correct | 23 ms | 34016 KB | Output is correct |
19 | Correct | 21 ms | 34048 KB | Output is correct |
20 | Correct | 22 ms | 34048 KB | Output is correct |
21 | Correct | 23 ms | 34048 KB | Output is correct |
22 | Correct | 21 ms | 34048 KB | Output is correct |
23 | Correct | 20 ms | 34048 KB | Output is correct |
24 | Correct | 24 ms | 34048 KB | Output is correct |
25 | Correct | 21 ms | 34052 KB | Output is correct |