# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
259072 |
2020-08-07T06:49:31 Z |
_7_7_ |
Duathlon (APIO18_duathlon) |
C++14 |
|
1000 ms |
13048 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef unsigned long long ull;
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;
typedef long long ll;
typedef double db;
typedef tree < int, null_type, less < int >, rb_tree_tag, tree_order_statistics_node_update > ordered_set;
const int inf = 1e9, maxn = 2e5 + 48, mod = 998244353, N = 1e5 + 512;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 300;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = acos(-1);
const ll INF = 1e18;
int n, m, v, u, ans, col[N], k;
bool was[52][52][52];
vi g[N];
void dfs (int v, int p) {
col[v] = k;
for (auto to : g[v])
if (to != p && !col[to])
dfs(to, p);
}
main () {
fastio
cin >> n >> m;
while (m--) {
cin >> v >> u;
g[v].pb(u);
g[u].pb(v);
}
int ans = n*(n - 1)*(n - 2);
for (int v = 1; v <= n; ++v) {
memset(col, 0, sizeof(col));
for (int i = 1; i <= n; ++i)
if (i != v && !col[i]) {
++k;
dfs(i, v);
}
for (int s = 1; s <= n; ++s)
for (int c = 1; c <= n; ++c)
if (c != v && col[s] != col[c])
for (int f = 1; f <= n; ++f)
if (f != s && col[c] != col[f] && !was[s][c][f]) {
--ans;
was[s][c][f] = 1;
}
}
cout << ans << endl;
}
Compilation message
count_triplets.cpp:56:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main () {
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3072 KB |
Output is correct |
2 |
Correct |
2 ms |
3072 KB |
Output is correct |
3 |
Correct |
2 ms |
3072 KB |
Output is correct |
4 |
Correct |
2 ms |
3072 KB |
Output is correct |
5 |
Correct |
2 ms |
3072 KB |
Output is correct |
6 |
Correct |
2 ms |
3072 KB |
Output is correct |
7 |
Correct |
2 ms |
3072 KB |
Output is correct |
8 |
Correct |
2 ms |
3072 KB |
Output is correct |
9 |
Correct |
2 ms |
3072 KB |
Output is correct |
10 |
Correct |
2 ms |
3072 KB |
Output is correct |
11 |
Correct |
2 ms |
3072 KB |
Output is correct |
12 |
Correct |
2 ms |
3072 KB |
Output is correct |
13 |
Correct |
2 ms |
3072 KB |
Output is correct |
14 |
Correct |
2 ms |
3072 KB |
Output is correct |
15 |
Correct |
2 ms |
3072 KB |
Output is correct |
16 |
Correct |
2 ms |
3072 KB |
Output is correct |
17 |
Correct |
3 ms |
3072 KB |
Output is correct |
18 |
Correct |
2 ms |
3072 KB |
Output is correct |
19 |
Correct |
2 ms |
3072 KB |
Output is correct |
20 |
Correct |
2 ms |
3072 KB |
Output is correct |
21 |
Correct |
2 ms |
3072 KB |
Output is correct |
22 |
Correct |
2 ms |
3072 KB |
Output is correct |
23 |
Correct |
2 ms |
3072 KB |
Output is correct |
24 |
Correct |
2 ms |
3072 KB |
Output is correct |
25 |
Correct |
2 ms |
3072 KB |
Output is correct |
26 |
Correct |
2 ms |
3072 KB |
Output is correct |
27 |
Correct |
2 ms |
3072 KB |
Output is correct |
28 |
Correct |
2 ms |
3072 KB |
Output is correct |
29 |
Correct |
2 ms |
3072 KB |
Output is correct |
30 |
Correct |
2 ms |
3072 KB |
Output is correct |
31 |
Correct |
2 ms |
3072 KB |
Output is correct |
32 |
Correct |
3 ms |
3072 KB |
Output is correct |
33 |
Correct |
3 ms |
3072 KB |
Output is correct |
34 |
Correct |
2 ms |
3072 KB |
Output is correct |
35 |
Correct |
2 ms |
3072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3072 KB |
Output is correct |
2 |
Correct |
2 ms |
3072 KB |
Output is correct |
3 |
Correct |
2 ms |
3072 KB |
Output is correct |
4 |
Correct |
2 ms |
3072 KB |
Output is correct |
5 |
Correct |
2 ms |
3072 KB |
Output is correct |
6 |
Correct |
2 ms |
3072 KB |
Output is correct |
7 |
Correct |
2 ms |
3072 KB |
Output is correct |
8 |
Correct |
2 ms |
3072 KB |
Output is correct |
9 |
Correct |
2 ms |
3072 KB |
Output is correct |
10 |
Correct |
2 ms |
3072 KB |
Output is correct |
11 |
Correct |
2 ms |
3072 KB |
Output is correct |
12 |
Correct |
2 ms |
3072 KB |
Output is correct |
13 |
Correct |
2 ms |
3072 KB |
Output is correct |
14 |
Correct |
2 ms |
3072 KB |
Output is correct |
15 |
Correct |
2 ms |
3072 KB |
Output is correct |
16 |
Correct |
2 ms |
3072 KB |
Output is correct |
17 |
Correct |
3 ms |
3072 KB |
Output is correct |
18 |
Correct |
2 ms |
3072 KB |
Output is correct |
19 |
Correct |
2 ms |
3072 KB |
Output is correct |
20 |
Correct |
2 ms |
3072 KB |
Output is correct |
21 |
Correct |
2 ms |
3072 KB |
Output is correct |
22 |
Correct |
2 ms |
3072 KB |
Output is correct |
23 |
Correct |
2 ms |
3072 KB |
Output is correct |
24 |
Correct |
2 ms |
3072 KB |
Output is correct |
25 |
Correct |
2 ms |
3072 KB |
Output is correct |
26 |
Correct |
2 ms |
3072 KB |
Output is correct |
27 |
Correct |
2 ms |
3072 KB |
Output is correct |
28 |
Correct |
2 ms |
3072 KB |
Output is correct |
29 |
Correct |
2 ms |
3072 KB |
Output is correct |
30 |
Correct |
2 ms |
3072 KB |
Output is correct |
31 |
Correct |
2 ms |
3072 KB |
Output is correct |
32 |
Correct |
3 ms |
3072 KB |
Output is correct |
33 |
Correct |
3 ms |
3072 KB |
Output is correct |
34 |
Correct |
2 ms |
3072 KB |
Output is correct |
35 |
Correct |
2 ms |
3072 KB |
Output is correct |
36 |
Correct |
17 ms |
3200 KB |
Output is correct |
37 |
Correct |
18 ms |
3200 KB |
Output is correct |
38 |
Correct |
9 ms |
3200 KB |
Output is correct |
39 |
Correct |
3 ms |
3200 KB |
Output is correct |
40 |
Correct |
4 ms |
3200 KB |
Output is correct |
41 |
Correct |
15 ms |
3200 KB |
Output is correct |
42 |
Correct |
13 ms |
3200 KB |
Output is correct |
43 |
Correct |
14 ms |
3328 KB |
Output is correct |
44 |
Correct |
13 ms |
3200 KB |
Output is correct |
45 |
Correct |
13 ms |
3200 KB |
Output is correct |
46 |
Correct |
15 ms |
3200 KB |
Output is correct |
47 |
Correct |
2 ms |
3072 KB |
Output is correct |
48 |
Correct |
16 ms |
3200 KB |
Output is correct |
49 |
Correct |
15 ms |
3200 KB |
Output is correct |
50 |
Correct |
15 ms |
3200 KB |
Output is correct |
51 |
Correct |
4 ms |
3200 KB |
Output is correct |
52 |
Correct |
4 ms |
3200 KB |
Output is correct |
53 |
Correct |
4 ms |
3200 KB |
Output is correct |
54 |
Correct |
5 ms |
3200 KB |
Output is correct |
55 |
Correct |
4 ms |
3200 KB |
Output is correct |
56 |
Correct |
4 ms |
3200 KB |
Output is correct |
57 |
Correct |
4 ms |
3200 KB |
Output is correct |
58 |
Correct |
4 ms |
3200 KB |
Output is correct |
59 |
Correct |
7 ms |
3200 KB |
Output is correct |
60 |
Correct |
10 ms |
3200 KB |
Output is correct |
61 |
Correct |
15 ms |
3200 KB |
Output is correct |
62 |
Correct |
18 ms |
3200 KB |
Output is correct |
63 |
Correct |
4 ms |
3200 KB |
Output is correct |
64 |
Correct |
4 ms |
3200 KB |
Output is correct |
65 |
Correct |
5 ms |
3200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
7800 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
11 ms |
6400 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
622 ms |
13048 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
10 ms |
6400 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
6348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3072 KB |
Output is correct |
2 |
Correct |
2 ms |
3072 KB |
Output is correct |
3 |
Correct |
2 ms |
3072 KB |
Output is correct |
4 |
Correct |
2 ms |
3072 KB |
Output is correct |
5 |
Correct |
2 ms |
3072 KB |
Output is correct |
6 |
Correct |
2 ms |
3072 KB |
Output is correct |
7 |
Correct |
2 ms |
3072 KB |
Output is correct |
8 |
Correct |
2 ms |
3072 KB |
Output is correct |
9 |
Correct |
2 ms |
3072 KB |
Output is correct |
10 |
Correct |
2 ms |
3072 KB |
Output is correct |
11 |
Correct |
2 ms |
3072 KB |
Output is correct |
12 |
Correct |
2 ms |
3072 KB |
Output is correct |
13 |
Correct |
2 ms |
3072 KB |
Output is correct |
14 |
Correct |
2 ms |
3072 KB |
Output is correct |
15 |
Correct |
2 ms |
3072 KB |
Output is correct |
16 |
Correct |
2 ms |
3072 KB |
Output is correct |
17 |
Correct |
3 ms |
3072 KB |
Output is correct |
18 |
Correct |
2 ms |
3072 KB |
Output is correct |
19 |
Correct |
2 ms |
3072 KB |
Output is correct |
20 |
Correct |
2 ms |
3072 KB |
Output is correct |
21 |
Correct |
2 ms |
3072 KB |
Output is correct |
22 |
Correct |
2 ms |
3072 KB |
Output is correct |
23 |
Correct |
2 ms |
3072 KB |
Output is correct |
24 |
Correct |
2 ms |
3072 KB |
Output is correct |
25 |
Correct |
2 ms |
3072 KB |
Output is correct |
26 |
Correct |
2 ms |
3072 KB |
Output is correct |
27 |
Correct |
2 ms |
3072 KB |
Output is correct |
28 |
Correct |
2 ms |
3072 KB |
Output is correct |
29 |
Correct |
2 ms |
3072 KB |
Output is correct |
30 |
Correct |
2 ms |
3072 KB |
Output is correct |
31 |
Correct |
2 ms |
3072 KB |
Output is correct |
32 |
Correct |
3 ms |
3072 KB |
Output is correct |
33 |
Correct |
3 ms |
3072 KB |
Output is correct |
34 |
Correct |
2 ms |
3072 KB |
Output is correct |
35 |
Correct |
2 ms |
3072 KB |
Output is correct |
36 |
Correct |
17 ms |
3200 KB |
Output is correct |
37 |
Correct |
18 ms |
3200 KB |
Output is correct |
38 |
Correct |
9 ms |
3200 KB |
Output is correct |
39 |
Correct |
3 ms |
3200 KB |
Output is correct |
40 |
Correct |
4 ms |
3200 KB |
Output is correct |
41 |
Correct |
15 ms |
3200 KB |
Output is correct |
42 |
Correct |
13 ms |
3200 KB |
Output is correct |
43 |
Correct |
14 ms |
3328 KB |
Output is correct |
44 |
Correct |
13 ms |
3200 KB |
Output is correct |
45 |
Correct |
13 ms |
3200 KB |
Output is correct |
46 |
Correct |
15 ms |
3200 KB |
Output is correct |
47 |
Correct |
2 ms |
3072 KB |
Output is correct |
48 |
Correct |
16 ms |
3200 KB |
Output is correct |
49 |
Correct |
15 ms |
3200 KB |
Output is correct |
50 |
Correct |
15 ms |
3200 KB |
Output is correct |
51 |
Correct |
4 ms |
3200 KB |
Output is correct |
52 |
Correct |
4 ms |
3200 KB |
Output is correct |
53 |
Correct |
4 ms |
3200 KB |
Output is correct |
54 |
Correct |
5 ms |
3200 KB |
Output is correct |
55 |
Correct |
4 ms |
3200 KB |
Output is correct |
56 |
Correct |
4 ms |
3200 KB |
Output is correct |
57 |
Correct |
4 ms |
3200 KB |
Output is correct |
58 |
Correct |
4 ms |
3200 KB |
Output is correct |
59 |
Correct |
7 ms |
3200 KB |
Output is correct |
60 |
Correct |
10 ms |
3200 KB |
Output is correct |
61 |
Correct |
15 ms |
3200 KB |
Output is correct |
62 |
Correct |
18 ms |
3200 KB |
Output is correct |
63 |
Correct |
4 ms |
3200 KB |
Output is correct |
64 |
Correct |
4 ms |
3200 KB |
Output is correct |
65 |
Correct |
5 ms |
3200 KB |
Output is correct |
66 |
Runtime error |
297 ms |
6392 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
67 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3072 KB |
Output is correct |
2 |
Correct |
2 ms |
3072 KB |
Output is correct |
3 |
Correct |
2 ms |
3072 KB |
Output is correct |
4 |
Correct |
2 ms |
3072 KB |
Output is correct |
5 |
Correct |
2 ms |
3072 KB |
Output is correct |
6 |
Correct |
2 ms |
3072 KB |
Output is correct |
7 |
Correct |
2 ms |
3072 KB |
Output is correct |
8 |
Correct |
2 ms |
3072 KB |
Output is correct |
9 |
Correct |
2 ms |
3072 KB |
Output is correct |
10 |
Correct |
2 ms |
3072 KB |
Output is correct |
11 |
Correct |
2 ms |
3072 KB |
Output is correct |
12 |
Correct |
2 ms |
3072 KB |
Output is correct |
13 |
Correct |
2 ms |
3072 KB |
Output is correct |
14 |
Correct |
2 ms |
3072 KB |
Output is correct |
15 |
Correct |
2 ms |
3072 KB |
Output is correct |
16 |
Correct |
2 ms |
3072 KB |
Output is correct |
17 |
Correct |
3 ms |
3072 KB |
Output is correct |
18 |
Correct |
2 ms |
3072 KB |
Output is correct |
19 |
Correct |
2 ms |
3072 KB |
Output is correct |
20 |
Correct |
2 ms |
3072 KB |
Output is correct |
21 |
Correct |
2 ms |
3072 KB |
Output is correct |
22 |
Correct |
2 ms |
3072 KB |
Output is correct |
23 |
Correct |
2 ms |
3072 KB |
Output is correct |
24 |
Correct |
2 ms |
3072 KB |
Output is correct |
25 |
Correct |
2 ms |
3072 KB |
Output is correct |
26 |
Correct |
2 ms |
3072 KB |
Output is correct |
27 |
Correct |
2 ms |
3072 KB |
Output is correct |
28 |
Correct |
2 ms |
3072 KB |
Output is correct |
29 |
Correct |
2 ms |
3072 KB |
Output is correct |
30 |
Correct |
2 ms |
3072 KB |
Output is correct |
31 |
Correct |
2 ms |
3072 KB |
Output is correct |
32 |
Correct |
3 ms |
3072 KB |
Output is correct |
33 |
Correct |
3 ms |
3072 KB |
Output is correct |
34 |
Correct |
2 ms |
3072 KB |
Output is correct |
35 |
Correct |
2 ms |
3072 KB |
Output is correct |
36 |
Correct |
17 ms |
3200 KB |
Output is correct |
37 |
Correct |
18 ms |
3200 KB |
Output is correct |
38 |
Correct |
9 ms |
3200 KB |
Output is correct |
39 |
Correct |
3 ms |
3200 KB |
Output is correct |
40 |
Correct |
4 ms |
3200 KB |
Output is correct |
41 |
Correct |
15 ms |
3200 KB |
Output is correct |
42 |
Correct |
13 ms |
3200 KB |
Output is correct |
43 |
Correct |
14 ms |
3328 KB |
Output is correct |
44 |
Correct |
13 ms |
3200 KB |
Output is correct |
45 |
Correct |
13 ms |
3200 KB |
Output is correct |
46 |
Correct |
15 ms |
3200 KB |
Output is correct |
47 |
Correct |
2 ms |
3072 KB |
Output is correct |
48 |
Correct |
16 ms |
3200 KB |
Output is correct |
49 |
Correct |
15 ms |
3200 KB |
Output is correct |
50 |
Correct |
15 ms |
3200 KB |
Output is correct |
51 |
Correct |
4 ms |
3200 KB |
Output is correct |
52 |
Correct |
4 ms |
3200 KB |
Output is correct |
53 |
Correct |
4 ms |
3200 KB |
Output is correct |
54 |
Correct |
5 ms |
3200 KB |
Output is correct |
55 |
Correct |
4 ms |
3200 KB |
Output is correct |
56 |
Correct |
4 ms |
3200 KB |
Output is correct |
57 |
Correct |
4 ms |
3200 KB |
Output is correct |
58 |
Correct |
4 ms |
3200 KB |
Output is correct |
59 |
Correct |
7 ms |
3200 KB |
Output is correct |
60 |
Correct |
10 ms |
3200 KB |
Output is correct |
61 |
Correct |
15 ms |
3200 KB |
Output is correct |
62 |
Correct |
18 ms |
3200 KB |
Output is correct |
63 |
Correct |
4 ms |
3200 KB |
Output is correct |
64 |
Correct |
4 ms |
3200 KB |
Output is correct |
65 |
Correct |
5 ms |
3200 KB |
Output is correct |
66 |
Execution timed out |
1085 ms |
7800 KB |
Time limit exceeded |
67 |
Halted |
0 ms |
0 KB |
- |