| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 94180 | gs14004 | Paths (BOI18_paths) | C++17 | 503 ms | 56692 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using pi = pair<int, int>;
using lint = long long;
const int MAXN = 300005;
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;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
