# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
615258 |
2022-07-31T08:02:48 Z |
박상훈(#8491) |
Broken Device 2 (JOI22_device2) |
C++17 |
|
681 ms |
27660 KB |
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
namespace {
vector<int> X, Y;
int cnt[2];
}
int Declare() {
return 2000;
}
void encode(vector<int>::iterator a, vector<int>::iterator b, int val, bool rev = 0){
int rval = val % 3;
fill(a+7, a+13, 1);
fill(b+7, b+13, 1);
if (rval==0) a[13] = 1, b[13] = 1;
if (rval==1) a[3] = 1, b[3] = 1;
if (rval==2) a[1] = 1, b[1] = 1;
if (val >= 3){
for (int i=0;i<14;i++) a[i] ^= 1, b[i] ^= 1;
}
if (rev){
reverse(a, a+14); reverse(b, b+14);
}
}
std::pair<std::vector<int>, std::vector<int> > Anna(long long p) {
X.clear(); Y.clear();
cnt[0] = -1, cnt[1] = -1;
ll q = p / 36, r = p % 36;
for (ll i=1;i<2000;i++) if (i*i > q){
ll prv = (i-1) * (i-1);
int j = q - prv;
cnt[0] = j, cnt[1] = (i-1)*2-j;
break;
}
assert(cnt[0] >= 0 && cnt[1] >= 0);
X.resize((cnt[0]+cnt[1]) / 2 + 28, 0);
Y.resize((cnt[0]+cnt[1]) / 2 + 28, 0);
encode(X.begin(), Y.begin(), r/6);
encode(X.end()-14, Y.end()-14, r%6, 1);
for (int i=14;i<(int)X.size()-14;i++){
if (cnt[0]) {--cnt[0];}
else {X[i] = 1; --cnt[1];}
}
for (int i=14;i<(int)Y.size()-14;i++){
if (cnt[0]) {--cnt[0];}
else {Y[i] = 1; --cnt[1];}
}
/*for (auto &x:X) printf("%d ", x);
printf("\n");
for (auto &x:Y) printf("%d ", x);
printf("\n");*/
return make_pair(X, Y);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
namespace {
ll cnt[2];
}
long long Bruno(std::vector<int> u) {
cnt[0] = -28, cnt[1] = -28;
ll r1 = 0, r2 = 0;
if (u[0]==1) r1 += 3;
if (u.back()==1) r2 += 3;
for (int i=1;i<7;i++) if (u[i]!=u[0]){
if (i<=2) r1 += 2;
else r1 += 1;
break;
}
for (int i=1;i<7;i++) if (u[(int)u.size()-i-1]!=u[(int)u.size()-1]){
if (i<=2) r2 += 2;
else r2 += 1;
break;
}
ll q;
for (auto &x:u) cnt[x]++;
q = (cnt[0]+cnt[1]) * (cnt[0]+cnt[1]) / 4 + cnt[0];
//printf(" %lld %lld %lld (%lld %lld)\n", q, r1, r2, cnt[0], cnt[1]);
return q * 36 + r1 * 6 + r2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
19 ms |
1136 KB |
Output is correct |
3 |
Correct |
20 ms |
1148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
19 ms |
1136 KB |
Output is correct |
3 |
Correct |
20 ms |
1148 KB |
Output is correct |
4 |
Correct |
102 ms |
4912 KB |
Output is correct |
5 |
Correct |
117 ms |
4932 KB |
Output is correct |
6 |
Correct |
115 ms |
4900 KB |
Output is correct |
7 |
Correct |
96 ms |
4752 KB |
Output is correct |
8 |
Correct |
112 ms |
4844 KB |
Output is correct |
9 |
Correct |
170 ms |
6404 KB |
Output is correct |
10 |
Correct |
150 ms |
6260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
19 ms |
1136 KB |
Output is correct |
3 |
Correct |
20 ms |
1148 KB |
Output is correct |
4 |
Correct |
102 ms |
4912 KB |
Output is correct |
5 |
Correct |
117 ms |
4932 KB |
Output is correct |
6 |
Correct |
115 ms |
4900 KB |
Output is correct |
7 |
Correct |
96 ms |
4752 KB |
Output is correct |
8 |
Correct |
112 ms |
4844 KB |
Output is correct |
9 |
Correct |
170 ms |
6404 KB |
Output is correct |
10 |
Correct |
150 ms |
6260 KB |
Output is correct |
11 |
Correct |
188 ms |
7020 KB |
Output is correct |
12 |
Correct |
150 ms |
7048 KB |
Output is correct |
13 |
Correct |
154 ms |
6908 KB |
Output is correct |
14 |
Correct |
155 ms |
6932 KB |
Output is correct |
15 |
Correct |
149 ms |
6912 KB |
Output is correct |
16 |
Correct |
212 ms |
9480 KB |
Output is correct |
17 |
Correct |
204 ms |
9416 KB |
Output is correct |
18 |
Correct |
122 ms |
5152 KB |
Output is correct |
19 |
Correct |
148 ms |
5432 KB |
Output is correct |
20 |
Correct |
110 ms |
5168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
19 ms |
1136 KB |
Output is correct |
3 |
Correct |
20 ms |
1148 KB |
Output is correct |
4 |
Correct |
102 ms |
4912 KB |
Output is correct |
5 |
Correct |
117 ms |
4932 KB |
Output is correct |
6 |
Correct |
115 ms |
4900 KB |
Output is correct |
7 |
Correct |
96 ms |
4752 KB |
Output is correct |
8 |
Correct |
112 ms |
4844 KB |
Output is correct |
9 |
Correct |
170 ms |
6404 KB |
Output is correct |
10 |
Correct |
150 ms |
6260 KB |
Output is correct |
11 |
Correct |
188 ms |
7020 KB |
Output is correct |
12 |
Correct |
150 ms |
7048 KB |
Output is correct |
13 |
Correct |
154 ms |
6908 KB |
Output is correct |
14 |
Correct |
155 ms |
6932 KB |
Output is correct |
15 |
Correct |
149 ms |
6912 KB |
Output is correct |
16 |
Correct |
212 ms |
9480 KB |
Output is correct |
17 |
Correct |
204 ms |
9416 KB |
Output is correct |
18 |
Correct |
122 ms |
5152 KB |
Output is correct |
19 |
Correct |
148 ms |
5432 KB |
Output is correct |
20 |
Correct |
110 ms |
5168 KB |
Output is correct |
21 |
Correct |
499 ms |
18880 KB |
Output is correct |
22 |
Correct |
465 ms |
19120 KB |
Output is correct |
23 |
Correct |
453 ms |
19088 KB |
Output is correct |
24 |
Correct |
509 ms |
18836 KB |
Output is correct |
25 |
Correct |
430 ms |
19032 KB |
Output is correct |
26 |
Correct |
665 ms |
27652 KB |
Output is correct |
27 |
Correct |
681 ms |
27660 KB |
Output is correct |
28 |
Correct |
303 ms |
13136 KB |
Output is correct |
29 |
Correct |
317 ms |
13508 KB |
Output is correct |
30 |
Correct |
332 ms |
14332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
19 ms |
1136 KB |
Output is correct |
3 |
Correct |
20 ms |
1148 KB |
Output is correct |
4 |
Correct |
102 ms |
4912 KB |
Output is correct |
5 |
Correct |
117 ms |
4932 KB |
Output is correct |
6 |
Correct |
115 ms |
4900 KB |
Output is correct |
7 |
Correct |
96 ms |
4752 KB |
Output is correct |
8 |
Correct |
112 ms |
4844 KB |
Output is correct |
9 |
Correct |
170 ms |
6404 KB |
Output is correct |
10 |
Correct |
150 ms |
6260 KB |
Output is correct |
11 |
Correct |
188 ms |
7020 KB |
Output is correct |
12 |
Correct |
150 ms |
7048 KB |
Output is correct |
13 |
Correct |
154 ms |
6908 KB |
Output is correct |
14 |
Correct |
155 ms |
6932 KB |
Output is correct |
15 |
Correct |
149 ms |
6912 KB |
Output is correct |
16 |
Correct |
212 ms |
9480 KB |
Output is correct |
17 |
Correct |
204 ms |
9416 KB |
Output is correct |
18 |
Correct |
122 ms |
5152 KB |
Output is correct |
19 |
Correct |
148 ms |
5432 KB |
Output is correct |
20 |
Correct |
110 ms |
5168 KB |
Output is correct |
21 |
Correct |
499 ms |
18880 KB |
Output is correct |
22 |
Correct |
465 ms |
19120 KB |
Output is correct |
23 |
Correct |
453 ms |
19088 KB |
Output is correct |
24 |
Correct |
509 ms |
18836 KB |
Output is correct |
25 |
Correct |
430 ms |
19032 KB |
Output is correct |
26 |
Correct |
665 ms |
27652 KB |
Output is correct |
27 |
Correct |
681 ms |
27660 KB |
Output is correct |
28 |
Correct |
303 ms |
13136 KB |
Output is correct |
29 |
Correct |
317 ms |
13508 KB |
Output is correct |
30 |
Correct |
332 ms |
14332 KB |
Output is correct |
31 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |