# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
698730 | 2023-02-14T08:51:51 Z | vjudge1 | Duathlon (APIO18_duathlon) | C++17 | 405 ms | 233264 KB |
#include <bits/stdc++.h> #include <array> #define all(v) (v.begin()), (v.end()) #define setall(a, val) for(auto& x : a) x = val #define ll long long clock_t start_time; double get_time() { return (double)(clock() - start_time) / CLOCKS_PER_SEC; } void init() { #ifndef ONLINE_JUDGE FILE* _ = freopen("in.txt", "r", stdin); start_time = clock(); #endif } const ll MOD = 998244353; const ll N = 1e5 + 1; const ll M = 2e2 + 1; using namespace std; //#################################################################################### bool vis[N]; int ans = 0; vector< vector<int> > v; void dfs(int cur, int dst) { vis[cur] = 1; if (dst > 1) ans += dst - 1; for (int nxt : v[cur]) { if (!vis[nxt]) dfs(nxt, dst + 1); } vis[cur] = 0; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0)); init(); int n, m; cin >> n >> m; v.resize(n + 1); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; v[a].push_back(b); v[b].push_back(a); } for (int i = 1; i <= n; i++) { setall(vis, 0); dfs(i, 0); } cout << ans << endl; cerr << get_time() << "s" << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 389 ms | 233252 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 389 ms | 233252 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 401 ms | 233232 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 394 ms | 233264 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 402 ms | 233248 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 405 ms | 233172 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 395 ms | 233216 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 389 ms | 233252 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 389 ms | 233252 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |