# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
807572 | dong_liu | Paths (BOI18_paths) | C++17 | 229 ms | 46272 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
inline int p2(const int& b) { return 1 << b; }
const int N = 3e5, K = 5;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, m, k;
cin >> n >> m >> k;
static int c[N];
for (int i = 0; i < n; i++) cin >> c[i], c[i]--;
static vector<int> g[N];
static ll f[1 << K][N];
for (int h = 0; h < m; h++) {
int i, j;
cin >> i >> j, i--, j--;
if (c[i] != c[j]) {
g[i].push_back(j), g[j].push_back(i);
f[p2(c[i]) | p2(c[j])][i] += 1, f[p2(c[i]) | p2(c[j])][j] += 1;
}
}
ll ans = 0;
for (int b = 0; b < 1 << k; b++)
for (int i = 0; i < n; i++)
if (f[b][i]) {
# | 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... |