제출 #1252568

#제출 시각아이디문제언어결과실행 시간메모리
1252568bzzzzzzzzzz세계 지도 (IOI25_worldmap)C++20
7 / 100
45 ms10564 KiB
#include <bits/stdc++.h> #include "worldmap.h" using namespace std; using ll = long long; const int SIZE = 41; vector<int> o; vector<int> used(SIZE, 0); vector<vector<int>> g(SIZE); void dfs(int v) { o.push_back(v); used[v] = 1; for (auto i : g[v]) { if (used[i] == 0) { dfs(i); o.push_back(v); } } } std::vector<std::vector<int>> create_map(int N, int M, std::vector<int> A, std::vector<int> B) { int p = 0; for (int i = 0; i < M; i++) { if (A[i] == 1) { p++; } if (B[i] == 1) { p++; } } if (M == N * (N - 1) / 2) { vector<vector<int>> ans(240, vector<int> (240, 1)); int c = 0; int h = 0; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { ans[c][h] = i; ans[c][h + 1] = j; c++; if (c == 240) { c = 0; h += 2; } } } return ans; } else if (M == N - 1) { for (int i = 0; i < M; i++) { g[A[i]].push_back(B[i]); g[B[i]].push_back(A[i]); } dfs(1); int n = (int)o.size(); vector<vector<int>> ans(n, vector<int> (n, 1)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { ans[i][j] = o[i]; } } return ans; } else { vector<vector<int>> ans(240, vector<int> (240, 1)); int c = 0; int h = 0; for (int i = 0; i < M; i++) { ans[c][h] = A[i]; ans[c][h + 1] = B[i]; c += 2; if (c >= 240) { c = 0; h += 3; } } return ans; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...