| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 426254 | lovrot | Paths (BOI18_paths) | C++11 | 73 ms | 11040 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define X first
#define Y second
#define ll long long
using namespace std;
const int N = 2010;
int n,a,b;
int c[N];
long long int out;
long long int memo[N][N];
vector<int> p[N];
long long int dfs(int x,int y){
if(memo[x][y] != 0)
return memo[x][y];
memo[x][y] = 1;
for(int i=0;i<p[x].size();i++){
if((1<<c[p[x][i]]) & y)
continue;
memo[x][y]+=dfs(p[x][i],y+(1<<c[p[x][i]]));
}
return memo[x][y];
}
int main(){
ios_base::sync_with_stdio(false);
int m,k;
cin >> n >> m >> k;
for(int i=0;i<n;i++)
cin >> c[i];
for(int i=0;i<m;i++){
cin >> a >> b;
a--;
b--;
p[a].push_back(b);
p[b].push_back(a);
}
for(int i=0;i<n;i++){
out+=dfs(i,0+(1<<c[i]));
}
cout<< out-n << "\n";
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
