# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
821064 | 2023-08-11T07:15:29 Z | boris_mihov | Marshmallow Molecules (CCO19_day2problem2) | C++17 | 565 ms | 3540 KB |
#include <algorithm> #include <iostream> #include <numeric> #include <cassert> #include <vector> #include <bitset> #include <queue> #include <stack> #include <set> #include <map> typedef long long llong; const int MAXN = 5000 + 10; const llong INF = 1e18; const int INTINF = 1e9; int n, m; std::vector <int> g[MAXN]; std::bitset <MAXN> bs[MAXN]; void solve() { for (int i = 1 ; i <= n ; ++i) { std::bitset <MAXN> toOR; for (int j = i - 1 ; j >= 1 ; --j) { if (bs[j][i]) { toOR |= bs[j]; } } bs[i] |= (toOR >> i + 1) << i + 1; } int cnt = 0; for (int i = 1 ; i <= n ; ++i) { cnt += bs[i].count(); } std::cout << cnt << '\n'; } void input() { std::cin >> n >> m; for (int i = 1 ; i <= m ; ++i) { int u, v; std::cin >> u >> v; bs[u][v] = 1; } } void fastIOI() { std::ios_base :: sync_with_stdio(0); std::cout.tie(nullptr); std::cin.tie(nullptr); } int main() { fastIOI(); input(); solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 468 KB | Output is correct |
4 | Correct | 1 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 2 ms | 468 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 468 KB | Output is correct |
9 | Correct | 1 ms | 468 KB | Output is correct |
10 | Correct | 1 ms | 468 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 1 ms | 468 KB | Output is correct |
13 | Correct | 1 ms | 468 KB | Output is correct |
14 | Correct | 1 ms | 468 KB | Output is correct |
15 | Correct | 1 ms | 468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 468 KB | Output is correct |
4 | Correct | 1 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 2 ms | 468 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 468 KB | Output is correct |
9 | Correct | 1 ms | 468 KB | Output is correct |
10 | Correct | 1 ms | 468 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 1 ms | 468 KB | Output is correct |
13 | Correct | 1 ms | 468 KB | Output is correct |
14 | Correct | 1 ms | 468 KB | Output is correct |
15 | Correct | 1 ms | 468 KB | Output is correct |
16 | Correct | 461 ms | 3516 KB | Output is correct |
17 | Correct | 475 ms | 3492 KB | Output is correct |
18 | Correct | 513 ms | 3492 KB | Output is correct |
19 | Correct | 565 ms | 3500 KB | Output is correct |
20 | Correct | 551 ms | 3540 KB | Output is correct |
21 | Correct | 430 ms | 3428 KB | Output is correct |
22 | Correct | 483 ms | 3512 KB | Output is correct |
23 | Correct | 486 ms | 3488 KB | Output is correct |
24 | Correct | 519 ms | 3508 KB | Output is correct |
25 | Correct | 504 ms | 3500 KB | Output is correct |
26 | Correct | 537 ms | 3504 KB | Output is correct |
27 | Correct | 414 ms | 3436 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 724 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 468 KB | Output is correct |
4 | Correct | 1 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 2 ms | 468 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 468 KB | Output is correct |
9 | Correct | 1 ms | 468 KB | Output is correct |
10 | Correct | 1 ms | 468 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 1 ms | 468 KB | Output is correct |
13 | Correct | 1 ms | 468 KB | Output is correct |
14 | Correct | 1 ms | 468 KB | Output is correct |
15 | Correct | 1 ms | 468 KB | Output is correct |
16 | Correct | 461 ms | 3516 KB | Output is correct |
17 | Correct | 475 ms | 3492 KB | Output is correct |
18 | Correct | 513 ms | 3492 KB | Output is correct |
19 | Correct | 565 ms | 3500 KB | Output is correct |
20 | Correct | 551 ms | 3540 KB | Output is correct |
21 | Correct | 430 ms | 3428 KB | Output is correct |
22 | Correct | 483 ms | 3512 KB | Output is correct |
23 | Correct | 486 ms | 3488 KB | Output is correct |
24 | Correct | 519 ms | 3508 KB | Output is correct |
25 | Correct | 504 ms | 3500 KB | Output is correct |
26 | Correct | 537 ms | 3504 KB | Output is correct |
27 | Correct | 414 ms | 3436 KB | Output is correct |
28 | Runtime error | 1 ms | 724 KB | Execution killed with signal 11 |
29 | Halted | 0 ms | 0 KB | - |