Linux tsuru-no-tsurugi 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
Apache/2.4.52 (Ubuntu)
Server IP : 192.168.0.18 & Your IP : 216.73.217.105
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
submit2 /
114884 /
Delete
Unzip
Name
Size
Permission
Date
Action
a.cpp
1003
B
-rwxr-x---
2024-08-28 22:35
cerror.txt
0
B
-rwxr-x---
2024-08-28 22:35
error.txt
0
B
-rwxr-x---
2024-08-28 22:35
submit_info.txt
201
B
-rwxr-x---
2024-08-28 22:35
Save
Rename
#include <iostream> #include <functional> #include <vector> signed main() { int n, m, x, p; std::cin >> n >> m >> x >> p; std::vector<int> b(n); std::vector<int> t(m); for (int &a : b) std::cin >> a; for (int &a : t) std::cin >> a; std::vector<bool> has(m); for (int mise : b) for (int i = 0; i < m; i++) if (abs(t[i] - mise) <= p) has[i] = true; std::vector<std::vector<int>> edge(m); for (int i = 0, u, v; i < x; i++) { std::cin >> u >> v; edge[u].push_back(v); edge[v].push_back(u); } std::vector<bool> vis(m); std::function<void(int)> dfs = [&] (int u) { vis[u] = true; for (int v : edge[u]) if (!vis[v]) dfs(v); }; int ans = 0; for (int i = 0; i < m; i++) if (has[i] && !vis[i]) { dfs(i); ans++; } std::cout << ans << '\n'; }