Submission #66359839
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;using ll = long long;int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int N, M;cin >> N >> M;vector<vector<pair<int, int>>> g(N);for (int i = 0; i < M; ++i) {int u, v, w;cin >> u >> v >> w;--u; --v;g[u].emplace_back(v, w);g[v].emplace_back(u, w);}const int MAX_W = 30;
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, M;
cin >> N >> M;
vector<vector<pair<int, int>>> g(N);
for (int i = 0; i < M; ++i) {
int u, v, w;
cin >> u >> v >> w;
--u; --v;
g[u].emplace_back(v, w);
g[v].emplace_back(u, w);
}
const int MAX_W = 30;
vector<bitset<1 << MAX_W>> visited(N);
queue<pair<int, int>> q;
q.emplace(0, 0);
visited[0][0] = 1;
while (!q.empty()) {
auto [v, cost] = q.front(); q.pop();
for (auto [to, w] : g[v]) {
int new_cost = cost | w;
if (!visited[to][new_cost]) {
visited[to][new_cost] = 1;
q.emplace(to, new_cost);
}
}
}
for (int i = 0; i < (1 << MAX_W); ++i) {
if (visited[N - 1][i]) {
cout << i << '\n';
break;
}
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Minimum OR Path |
| User | potat_p |
| Language | C++ 20 (gcc 12.2) |
| Score | 0 |
| Code Size | 1039 Byte |
| Status | RE |
| Exec Time | 3360 ms |
| Memory | 1051600 KiB |
Judge Result
| Set Name | Sample | All | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 450 | ||||||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 213 ms | 527344 KiB |
| 00_sample_01.txt | AC | 157 ms | 396408 KiB |
| 00_sample_02.txt | MLE | 689 ms | 1051600 KiB |
| 01_handmade_00.txt | AC | 106 ms | 265148 KiB |
| 01_handmade_01.txt | AC | 728 ms | 265156 KiB |
| 01_handmade_02.txt | TLE | 3360 ms | 938824 KiB |
| 01_handmade_03.txt | TLE | 3324 ms | 268556 KiB |
| 01_handmade_04.txt | RE | 242 ms | 3452 KiB |
| 01_handmade_05.txt | RE | 81 ms | 3464 KiB |
| 01_handmade_06.txt | RE | 82 ms | 3552 KiB |
| 01_handmade_07.txt | RE | 115 ms | 10020 KiB |
| 01_handmade_08.txt | RE | 114 ms | 10068 KiB |
| 01_handmade_09.txt | RE | 114 ms | 10064 KiB |
| 02_random_00.txt | RE | 122 ms | 10864 KiB |
| 02_random_01.txt | RE | 116 ms | 9236 KiB |
| 02_random_02.txt | RE | 104 ms | 6612 KiB |
| 02_random_03.txt | RE | 142 ms | 10232 KiB |
| 02_random_04.txt | RE | 136 ms | 10272 KiB |
| 02_random_05.txt | RE | 123 ms | 9524 KiB |
| 02_random_06.txt | RE | 127 ms | 9404 KiB |
| 02_random_07.txt | RE | 149 ms | 11916 KiB |
| 02_random_08.txt | RE | 155 ms | 13656 KiB |
| 02_random_09.txt | RE | 121 ms | 10416 KiB |
| 02_random_10.txt | RE | 151 ms | 12228 KiB |
| 02_random_11.txt | RE | 158 ms | 12944 KiB |
| 02_random_12.txt | RE | 152 ms | 11412 KiB |
| 02_random_13.txt | RE | 155 ms | 14068 KiB |
| 02_random_14.txt | RE | 152 ms | 13732 KiB |
| 02_random_15.txt | RE | 116 ms | 8296 KiB |
| 02_random_16.txt | RE | 121 ms | 10080 KiB |
| 02_random_17.txt | RE | 114 ms | 10092 KiB |
| 02_random_18.txt | RE | 119 ms | 10072 KiB |
| 02_random_19.txt | RE | 153 ms | 14392 KiB |
| 02_random_20.txt | RE | 147 ms | 14404 KiB |
| 02_random_21.txt | RE | 154 ms | 14396 KiB |