Submission #1250299

#TimeUsernameProblemLanguageResultExecution timeMemory
1250299haiphong5g0World Map (IOI25_worldmap)C++20
72 / 100
73 ms9544 KiB
//#include "worldmap.h" #include <bits/stdc++.h> #define task "TEST" #define task2 "A" #define pl pair<ll, ll> #define pf push_front #define pb push_back #define pob pop_back #define pof pop_front #define mp make_pair #define fi first #define se second #define FOR(i, a, b, c) for (int i=a; i<=b; i+=c) #define FORE(i, a, b, c) for (int i=a; i>=b; i+=c) using namespace std; using ll = long long; using ull = unsigned long long; const int Mod = 998244353; const int maxn = 1e3; const ll Inf = 1e16; vector<int> adj[maxn+1]; vector<vector<int>> res; vector<vector<int>> newv; vector<int> L; int ck[maxn+1]; void DFS(ll v) { L.pb(v); ck[v] = true; for (auto p : adj[v]) { if (ck[p]) continue; DFS(p); L.pb(v); } } std::vector<std::vector<int>> create_map(int n, int m, std::vector<int> A, std::vector<int> B) { L.clear(); res = newv; FOR(i, 1, n, 1) adj[i].clear(); FOR(i, 1, n, 1) ck[i] = false; FOR(i, 0, m-1, 1) { adj[A[i]].pb(B[i]); adj[B[i]].pb(A[i]); } DFS(1); res.resize(L.size()*3); FOR(i, 0, L.size()*3-1, 1) res[i].resize(0); int row = 0; for (auto p : L) { if (ck[p]) { res[row].resize(L.size()*3, p); res[row+2].resize(L.size()*3, p); for (auto q : adj[p]) { res[row+1].pb(q); res[row+1].pb(p); } res[row+1].resize(L.size()*3, p); row += 3; } else { res[row].resize(L.size()*3, p); row++; } ck[p] = false; } res.resize(row); FOR(i, 0, row-1, 1) res[i].resize(row); return res; }
#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...