Submission #1024565

# Submission time Handle Problem Language Result Execution time Memory
1024565 2024-07-16T07:53:57 Z 우민규(#10936) Broken Device 2 (JOI22_device2) C++17
80 / 100
59 ms 4096 KB
#include "Anna.h"

#include <utility>
#include <vector>
using namespace std;

namespace {
const int BITS = 60;
}

int Declare() { return 3 * BITS; }

pair<vector<int>, vector<int>> Anna(long long a) {
  // gather a's bits
  vector<int> a_bits;
  while (a > 0) {
    a_bits.push_back(a % 2);
    a /= 2;
  }
  while (a_bits.size() < BITS) a_bits.push_back(0);
  vector<int> u, v;
  for (auto bit : a_bits) {
    u.push_back(bit);
    u.push_back(bit);
    u.push_back(bit);
  }
  v.push_back(0);
  while (v.size() < u.size()) v.push_back(!v.back());
  return make_pair(u, v);
}
#include "Bruno.h"

#include <utility>
#include <vector>
using namespace std;

namespace {

// const int BITS = 5;

}

long long Bruno(vector<int> u) {
  // remove u's elements
  // u_red: (value, count)
  vector<pair<int, int>> u_red;
  int pu = 4;
  for (auto u : u) {
    if (u == pu) {
      if (u_red.empty() || u_red.back().first != u) {
        u_red.push_back({u, 1});
      } else {
        u_red.back().second += 1;
      }
    }
    pu = u;
  }
  vector<int> a_bits;
  for (auto [v, c] : u_red) {
    for (int i = 0; i < (c + 2) / 3; ++i) a_bits.push_back(v);
  }
  long long a = 0;
  for (int i = a_bits.size() - 1; i >= 0; --i) {
    a = 2 * a + a_bits[i];
  }
  return a;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 780 KB Output is correct
2 Correct 44 ms 3640 KB Output is correct
3 Correct 44 ms 3536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 780 KB Output is correct
2 Correct 44 ms 3640 KB Output is correct
3 Correct 44 ms 3536 KB Output is correct
4 Correct 49 ms 3624 KB Output is correct
5 Correct 50 ms 3536 KB Output is correct
6 Correct 48 ms 3552 KB Output is correct
7 Correct 48 ms 3900 KB Output is correct
8 Correct 50 ms 3556 KB Output is correct
9 Correct 45 ms 3596 KB Output is correct
10 Correct 41 ms 3568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 780 KB Output is correct
2 Correct 44 ms 3640 KB Output is correct
3 Correct 44 ms 3536 KB Output is correct
4 Correct 49 ms 3624 KB Output is correct
5 Correct 50 ms 3536 KB Output is correct
6 Correct 48 ms 3552 KB Output is correct
7 Correct 48 ms 3900 KB Output is correct
8 Correct 50 ms 3556 KB Output is correct
9 Correct 45 ms 3596 KB Output is correct
10 Correct 41 ms 3568 KB Output is correct
11 Correct 48 ms 3560 KB Output is correct
12 Correct 50 ms 3480 KB Output is correct
13 Correct 49 ms 3768 KB Output is correct
14 Correct 50 ms 3692 KB Output is correct
15 Correct 49 ms 3536 KB Output is correct
16 Correct 45 ms 3572 KB Output is correct
17 Correct 46 ms 3468 KB Output is correct
18 Correct 51 ms 3476 KB Output is correct
19 Correct 48 ms 3568 KB Output is correct
20 Correct 49 ms 3544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 780 KB Output is correct
2 Correct 44 ms 3640 KB Output is correct
3 Correct 44 ms 3536 KB Output is correct
4 Correct 49 ms 3624 KB Output is correct
5 Correct 50 ms 3536 KB Output is correct
6 Correct 48 ms 3552 KB Output is correct
7 Correct 48 ms 3900 KB Output is correct
8 Correct 50 ms 3556 KB Output is correct
9 Correct 45 ms 3596 KB Output is correct
10 Correct 41 ms 3568 KB Output is correct
11 Correct 48 ms 3560 KB Output is correct
12 Correct 50 ms 3480 KB Output is correct
13 Correct 49 ms 3768 KB Output is correct
14 Correct 50 ms 3692 KB Output is correct
15 Correct 49 ms 3536 KB Output is correct
16 Correct 45 ms 3572 KB Output is correct
17 Correct 46 ms 3468 KB Output is correct
18 Correct 51 ms 3476 KB Output is correct
19 Correct 48 ms 3568 KB Output is correct
20 Correct 49 ms 3544 KB Output is correct
21 Correct 47 ms 3540 KB Output is correct
22 Correct 50 ms 3536 KB Output is correct
23 Correct 50 ms 3676 KB Output is correct
24 Correct 50 ms 3656 KB Output is correct
25 Correct 49 ms 3580 KB Output is correct
26 Correct 45 ms 3572 KB Output is correct
27 Correct 41 ms 3568 KB Output is correct
28 Correct 47 ms 3748 KB Output is correct
29 Correct 49 ms 3476 KB Output is correct
30 Correct 48 ms 3620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 780 KB Output is correct
2 Correct 44 ms 3640 KB Output is correct
3 Correct 44 ms 3536 KB Output is correct
4 Correct 49 ms 3624 KB Output is correct
5 Correct 50 ms 3536 KB Output is correct
6 Correct 48 ms 3552 KB Output is correct
7 Correct 48 ms 3900 KB Output is correct
8 Correct 50 ms 3556 KB Output is correct
9 Correct 45 ms 3596 KB Output is correct
10 Correct 41 ms 3568 KB Output is correct
11 Correct 48 ms 3560 KB Output is correct
12 Correct 50 ms 3480 KB Output is correct
13 Correct 49 ms 3768 KB Output is correct
14 Correct 50 ms 3692 KB Output is correct
15 Correct 49 ms 3536 KB Output is correct
16 Correct 45 ms 3572 KB Output is correct
17 Correct 46 ms 3468 KB Output is correct
18 Correct 51 ms 3476 KB Output is correct
19 Correct 48 ms 3568 KB Output is correct
20 Correct 49 ms 3544 KB Output is correct
21 Correct 47 ms 3540 KB Output is correct
22 Correct 50 ms 3536 KB Output is correct
23 Correct 50 ms 3676 KB Output is correct
24 Correct 50 ms 3656 KB Output is correct
25 Correct 49 ms 3580 KB Output is correct
26 Correct 45 ms 3572 KB Output is correct
27 Correct 41 ms 3568 KB Output is correct
28 Correct 47 ms 3748 KB Output is correct
29 Correct 49 ms 3476 KB Output is correct
30 Correct 48 ms 3620 KB Output is correct
31 Correct 48 ms 3572 KB Output is correct
32 Correct 48 ms 3548 KB Output is correct
33 Correct 47 ms 3744 KB Output is correct
34 Correct 49 ms 3508 KB Output is correct
35 Correct 48 ms 3600 KB Output is correct
36 Correct 47 ms 3564 KB Output is correct
37 Correct 41 ms 3544 KB Output is correct
38 Correct 49 ms 3488 KB Output is correct
39 Correct 48 ms 3472 KB Output is correct
40 Correct 47 ms 3708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 47 ms 3564 KB Output is partially correct
2 Partially correct 51 ms 3580 KB Output is partially correct
3 Partially correct 52 ms 3600 KB Output is partially correct
4 Partially correct 50 ms 3772 KB Output is partially correct
5 Partially correct 59 ms 3664 KB Output is partially correct
6 Partially correct 56 ms 3620 KB Output is partially correct
7 Partially correct 52 ms 3740 KB Output is partially correct
8 Partially correct 51 ms 3556 KB Output is partially correct
9 Partially correct 51 ms 3616 KB Output is partially correct
10 Partially correct 49 ms 3736 KB Output is partially correct
11 Partially correct 58 ms 3680 KB Output is partially correct
12 Partially correct 51 ms 3484 KB Output is partially correct
13 Partially correct 45 ms 3480 KB Output is partially correct
14 Partially correct 46 ms 3596 KB Output is partially correct
15 Partially correct 50 ms 3548 KB Output is partially correct
16 Partially correct 47 ms 3580 KB Output is partially correct
17 Partially correct 47 ms 3496 KB Output is partially correct
18 Partially correct 48 ms 3764 KB Output is partially correct
19 Partially correct 48 ms 3548 KB Output is partially correct
20 Partially correct 50 ms 4096 KB Output is partially correct