# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
345373 | 2021-01-07T08:03:56 Z | _zheksenov | Marriage questions (IZhO14_marriage) | C++14 | 1500 ms | 2284 KB |
#include <bits/stdc++.h> using namespace std; signed main() { int n, m, k; cin >> n >> m >> k; vector<vector<int> > g; g.resize(n + 2); for (int i = 0; i < k; i++) { int u, v; cin >> u >> v; g[u].push_back(v); } int ans = 0; for (int l = 1; l <= n; l++) { set<int> s; int cnt = 0; for (int r = l; r <= n; r++) { for (auto to : g[r]) s.insert(to); if (g[r].empty()) cnt++; int length = r - l + 1; if (s.size() == m && s.size() <= length - cnt) { ans++; } } } cout << ans << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 496 KB | Output is correct |
14 | Incorrect | 1 ms | 364 KB | Output isn't correct |
15 | Incorrect | 1 ms | 364 KB | Output isn't correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 11 ms | 364 KB | Output is correct |
20 | Correct | 3 ms | 364 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 4 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 173 ms | 492 KB | Output is correct |
26 | Incorrect | 43 ms | 364 KB | Output isn't correct |
27 | Correct | 12 ms | 364 KB | Output is correct |
28 | Correct | 3 ms | 512 KB | Output is correct |
29 | Correct | 42 ms | 512 KB | Output is correct |
30 | Correct | 45 ms | 364 KB | Output is correct |
31 | Execution timed out | 1585 ms | 676 KB | Time limit exceeded |
32 | Incorrect | 225 ms | 468 KB | Output isn't correct |
33 | Correct | 40 ms | 364 KB | Output is correct |
34 | Correct | 35 ms | 364 KB | Output is correct |
35 | Correct | 825 ms | 972 KB | Output is correct |
36 | Correct | 619 ms | 1004 KB | Output is correct |
37 | Execution timed out | 1592 ms | 748 KB | Time limit exceeded |
38 | Execution timed out | 1583 ms | 1132 KB | Time limit exceeded |
39 | Correct | 1401 ms | 748 KB | Output is correct |
40 | Execution timed out | 1597 ms | 876 KB | Time limit exceeded |
41 | Execution timed out | 1598 ms | 876 KB | Time limit exceeded |
42 | Execution timed out | 1542 ms | 1132 KB | Time limit exceeded |
43 | Execution timed out | 1576 ms | 1132 KB | Time limit exceeded |
44 | Execution timed out | 1556 ms | 1388 KB | Time limit exceeded |
45 | Execution timed out | 1530 ms | 1644 KB | Time limit exceeded |
46 | Execution timed out | 1550 ms | 2156 KB | Time limit exceeded |
47 | Execution timed out | 1564 ms | 2028 KB | Time limit exceeded |
48 | Execution timed out | 1535 ms | 2028 KB | Time limit exceeded |
49 | Execution timed out | 1566 ms | 2284 KB | Time limit exceeded |
50 | Execution timed out | 1545 ms | 1132 KB | Time limit exceeded |