# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
570331 | 2022-05-29T08:45:45 Z | 장태환(#8350) | From Hacks to Snitches (BOI21_watchmen) | C++17 | 88 ms | 9444 KB |
#include <bits/stdc++.h> //If you have fancy wingsuit t you won in your national computer science competition, then you can make a living from prizes awarded at computer science competitions using namespace std; vector<int>link[300100]; int mint[300100]; int ce[300100]; vector<vector<int>>arr; int main() { int N, K; cin >> N >> K; int i; for (i = 0; i < K; i++) { int a, b; cin >> a >> b; link[a].push_back(b); link[b].push_back(a); } for (i = 1; i <= N; i++) link[i].push_back(i); queue<pair<int, int>>t; int g,M; cin >> g; for (i = 0; i < g; i++) { vector<int>Tr; cin >> M; while (M--) { int a; cin >> a; Tr.push_back(a); } arr.push_back(Tr); } t.push({ 1,0 }); memset(mint, -1, sizeof(mint)); mint[1] = 0; pair<int, int>rc = { 0,0 }; while (t.size()) { auto r = t.front(); t.pop(); int j; int ccd = 0; for (j = 0; j < link[r.first].size(); j++) { int n = link[r.first][j]; if (n!=r.first&&mint[n] >= 0) continue; int k; for (k = 0; k < g; k++) { if (r.first == arr[k][r.second % arr[k].size()] || n == arr[k][(r.second + 1) % arr[k].size()] || n == arr[k][r.second % arr[k].size()] && r.first == arr[k][(r.second + 1) % arr[k].size()] ) goto T; } if (j + 1 != link[r.first].size()) ccd++; else { if (ccd) ce[r.first] = 0; else ce[r.first]++; if (ce[r.first] >= 400) break; } mint[n] = mint[r.first] + 1; t.push({ n,(r.second + 1)}); T: int d; } } cout << "impossible"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 88 ms | 9444 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 88 ms | 9376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 88 ms | 9376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 88 ms | 9376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 88 ms | 9444 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 88 ms | 9444 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 88 ms | 9444 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |