| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 153151 | Swan | Paths (BOI18_paths) | C++14 | 3050 ms | 8824 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define stop system("pause")
#define INP freopen("input.txt","r",stdin)
#define OUTP freopen("solve1.txt","w",stdout)
#define int long long
using namespace std;
typedef long long ll;
vector<vector<int> > v;
const int maxn = 4e5;
int color[maxn];
bool c_used[maxn];
bool used[maxn];
bool is_good(int mask,int x){
return !(mask&(1<<x));
}
int ans = 0 ;
void dfs(int u,int mask){
if(mask)ans++;
mask|=(1<<color[u]);
for(int i(0); i < v[u].size();i++){
int to = v[u][i];
if(!is_good(mask,color[to]))continue;
dfs(to,mask);
}
}
main()
{
ios_base::sync_with_stdio(0);
int n,m,k; cin >> n >> m >> k;
v.resize(n+2);
for(int i(0); i < n;i++)cin >> color[i];
for(int i(0); i < m;i++){
int a,b; cin >> a >> b;
a--;b--;
if(color[a] == color[b])continue;
v[a].push_back(b);
v[b].push_back(a);
}
for(int i(0); i < n;i++){
dfs(i,0);
}
cout << ans;
return 0;
}
/*
*/
컴파일 시 표준 에러 (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... | ||||
