/* https://www.ioi-jp.org/camp/2022/2022-sp-tasks/contest3/device2-review.pdf */
#include "Anna.h"
#include <vector>
using namespace std;
const int L = 2000;
typedef vector<int> vi;
namespace {
long long f(int l) {
return (l / 2 + 1) * ((l + 1) / 2 + 1);
}
}
int Declare() {
return L;
}
pair<vi, vi> Anna(long long x) {
x--;
int l = 1;
while (x >= f(l))
x -= f(l++);
vi aa(l, 0), bb(l, 0);
int kl = x % (l / 2 + 1), kr = x / (l / 2 + 1);
for (int i = 0; i < kl; i++)
aa[i] = bb[l / 2 - 1 - i] = 1;
for (int i = l / 2; i < l / 2 + kr; i++)
aa[i] = bb[l / 2 + l - 1 - i] = 1;
return make_pair(aa, bb);
}
/* https://www.ioi-jp.org/camp/2022/2022-sp-tasks/contest3/device2-review.pdf */
#include "Bruno.h"
#include <vector>
using namespace std;
typedef vector<int> vi;
namespace {
long long f(int l) {
return (l / 2 + 1) * ((l + 1) / 2 + 1);
}
}
long long Bruno(vi cc) {
int l = cc.size() / 2;
long long x = 1;
for (int l_ = 1; l_ < l; l_++)
x += f(l_);
int kl = 0;
for (int i = 0; i < l / 2; i++)
if (cc[i] == 1)
kl++;
int kr = 0;
for (int i = l * 2 - 1; i >= l * 2 - (l + 1) / 2; i--)
if (cc[i] == 1)
kr++;
return x + kr * (l / 2 + 1) + kl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
15 ms |
824 KB |
Output is correct |
3 |
Correct |
16 ms |
992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
15 ms |
824 KB |
Output is correct |
3 |
Correct |
16 ms |
992 KB |
Output is correct |
4 |
Correct |
108 ms |
5028 KB |
Output is correct |
5 |
Correct |
111 ms |
5124 KB |
Output is correct |
6 |
Correct |
111 ms |
5144 KB |
Output is correct |
7 |
Correct |
104 ms |
5064 KB |
Output is correct |
8 |
Correct |
114 ms |
5168 KB |
Output is correct |
9 |
Correct |
141 ms |
6480 KB |
Output is correct |
10 |
Correct |
139 ms |
6328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
15 ms |
824 KB |
Output is correct |
3 |
Correct |
16 ms |
992 KB |
Output is correct |
4 |
Correct |
108 ms |
5028 KB |
Output is correct |
5 |
Correct |
111 ms |
5124 KB |
Output is correct |
6 |
Correct |
111 ms |
5144 KB |
Output is correct |
7 |
Correct |
104 ms |
5064 KB |
Output is correct |
8 |
Correct |
114 ms |
5168 KB |
Output is correct |
9 |
Correct |
141 ms |
6480 KB |
Output is correct |
10 |
Correct |
139 ms |
6328 KB |
Output is correct |
11 |
Correct |
158 ms |
6652 KB |
Output is correct |
12 |
Correct |
175 ms |
6612 KB |
Output is correct |
13 |
Correct |
146 ms |
6612 KB |
Output is correct |
14 |
Correct |
148 ms |
6644 KB |
Output is correct |
15 |
Correct |
154 ms |
6676 KB |
Output is correct |
16 |
Correct |
199 ms |
8420 KB |
Output is correct |
17 |
Correct |
193 ms |
8256 KB |
Output is correct |
18 |
Correct |
113 ms |
5100 KB |
Output is correct |
19 |
Correct |
123 ms |
5168 KB |
Output is correct |
20 |
Correct |
114 ms |
4992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
15 ms |
824 KB |
Output is correct |
3 |
Correct |
16 ms |
992 KB |
Output is correct |
4 |
Correct |
108 ms |
5028 KB |
Output is correct |
5 |
Correct |
111 ms |
5124 KB |
Output is correct |
6 |
Correct |
111 ms |
5144 KB |
Output is correct |
7 |
Correct |
104 ms |
5064 KB |
Output is correct |
8 |
Correct |
114 ms |
5168 KB |
Output is correct |
9 |
Correct |
141 ms |
6480 KB |
Output is correct |
10 |
Correct |
139 ms |
6328 KB |
Output is correct |
11 |
Correct |
158 ms |
6652 KB |
Output is correct |
12 |
Correct |
175 ms |
6612 KB |
Output is correct |
13 |
Correct |
146 ms |
6612 KB |
Output is correct |
14 |
Correct |
148 ms |
6644 KB |
Output is correct |
15 |
Correct |
154 ms |
6676 KB |
Output is correct |
16 |
Correct |
199 ms |
8420 KB |
Output is correct |
17 |
Correct |
193 ms |
8256 KB |
Output is correct |
18 |
Correct |
113 ms |
5100 KB |
Output is correct |
19 |
Correct |
123 ms |
5168 KB |
Output is correct |
20 |
Correct |
114 ms |
4992 KB |
Output is correct |
21 |
Correct |
319 ms |
13424 KB |
Output is correct |
22 |
Correct |
324 ms |
13648 KB |
Output is correct |
23 |
Correct |
303 ms |
13488 KB |
Output is correct |
24 |
Correct |
310 ms |
13344 KB |
Output is correct |
25 |
Correct |
304 ms |
13300 KB |
Output is correct |
26 |
Correct |
395 ms |
17560 KB |
Output is correct |
27 |
Correct |
418 ms |
17424 KB |
Output is correct |
28 |
Correct |
220 ms |
9756 KB |
Output is correct |
29 |
Correct |
237 ms |
9948 KB |
Output is correct |
30 |
Correct |
258 ms |
10296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
15 ms |
824 KB |
Output is correct |
3 |
Correct |
16 ms |
992 KB |
Output is correct |
4 |
Correct |
108 ms |
5028 KB |
Output is correct |
5 |
Correct |
111 ms |
5124 KB |
Output is correct |
6 |
Correct |
111 ms |
5144 KB |
Output is correct |
7 |
Correct |
104 ms |
5064 KB |
Output is correct |
8 |
Correct |
114 ms |
5168 KB |
Output is correct |
9 |
Correct |
141 ms |
6480 KB |
Output is correct |
10 |
Correct |
139 ms |
6328 KB |
Output is correct |
11 |
Correct |
158 ms |
6652 KB |
Output is correct |
12 |
Correct |
175 ms |
6612 KB |
Output is correct |
13 |
Correct |
146 ms |
6612 KB |
Output is correct |
14 |
Correct |
148 ms |
6644 KB |
Output is correct |
15 |
Correct |
154 ms |
6676 KB |
Output is correct |
16 |
Correct |
199 ms |
8420 KB |
Output is correct |
17 |
Correct |
193 ms |
8256 KB |
Output is correct |
18 |
Correct |
113 ms |
5100 KB |
Output is correct |
19 |
Correct |
123 ms |
5168 KB |
Output is correct |
20 |
Correct |
114 ms |
4992 KB |
Output is correct |
21 |
Correct |
319 ms |
13424 KB |
Output is correct |
22 |
Correct |
324 ms |
13648 KB |
Output is correct |
23 |
Correct |
303 ms |
13488 KB |
Output is correct |
24 |
Correct |
310 ms |
13344 KB |
Output is correct |
25 |
Correct |
304 ms |
13300 KB |
Output is correct |
26 |
Correct |
395 ms |
17560 KB |
Output is correct |
27 |
Correct |
418 ms |
17424 KB |
Output is correct |
28 |
Correct |
220 ms |
9756 KB |
Output is correct |
29 |
Correct |
237 ms |
9948 KB |
Output is correct |
30 |
Correct |
258 ms |
10296 KB |
Output is correct |
31 |
Incorrect |
1 ms |
624 KB |
Wrong Answer [3] |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2084 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |