답안 #934820

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934820 2024-02-28T04:42:03 Z nguyentunglam Broken Device 2 (JOI22_device2) C++17
25 / 100
63 ms 3452 KB
#include "Anna.h"
#include <utility>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

namespace {

int x = 0;
}

int Declare() {
  return 180;
}

std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
  int m = log2(A) + 1;
  vector<int> s, t;
  for(int i = 0; i < m; i++) {
    s.push_back(A >> i & 1);
    s.push_back(A >> i & 1);
    s.push_back(A >> i & 1);
  }

  for(int i = 0, cur = 0; i < 3 * m; i++) {
    t.push_back(cur ^= 1);
  }

  return make_pair(s, t);
}
#include "Bruno.h"
#include <utility>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

namespace {

int variable_example = 0;

}

long long Bruno(std::vector<int> u) {
  vector<int> bit;
  int real_sum = 0, fake_sum = 0;

  for(int &j : u) {
    if (j == 0) fake_sum--;
    else fake_sum++;
    if (fake_sum > real_sum + 2) {
      real_sum += 3;
      bit.push_back(1);
    }
    if (fake_sum < real_sum - 1) {
      real_sum -= 3;
      bit.push_back(0);
    }
//    cout << real_sum << " " << fake_sum << " " << j << endl;
  }
//  for(int &j : u) cout << j; cout << endl;
//  for(int &j : bit) cout << j; cout << endl;
  long long ans = 0;
  for(int j = 0; j < bit.size(); j++) if (bit[j]) ans |= (1 << j);
//  cout << ans << endl;
  return ans;
}

Compilation message

Anna.cpp:9:5: warning: '{anonymous}::x' defined but not used [-Wunused-variable]
    9 | int x = 0;
      |     ^

Bruno.cpp: In function 'long long int Bruno(std::vector<int>)':
Bruno.cpp:33:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   for(int j = 0; j < bit.size(); j++) if (bit[j]) ans |= (1 << j);
      |                  ~~^~~~~~~~~~~~
Bruno.cpp: At global scope:
Bruno.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 15 ms 1156 KB Output is correct
3 Correct 17 ms 1428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 15 ms 1156 KB Output is correct
3 Correct 17 ms 1428 KB Output is correct
4 Correct 27 ms 1808 KB Output is correct
5 Correct 27 ms 1892 KB Output is correct
6 Correct 27 ms 1884 KB Output is correct
7 Correct 27 ms 1728 KB Output is correct
8 Correct 27 ms 1812 KB Output is correct
9 Correct 26 ms 1832 KB Output is correct
10 Correct 25 ms 1764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 15 ms 1156 KB Output is correct
3 Correct 17 ms 1428 KB Output is correct
4 Correct 27 ms 1808 KB Output is correct
5 Correct 27 ms 1892 KB Output is correct
6 Correct 27 ms 1884 KB Output is correct
7 Correct 27 ms 1728 KB Output is correct
8 Correct 27 ms 1812 KB Output is correct
9 Correct 26 ms 1832 KB Output is correct
10 Correct 25 ms 1764 KB Output is correct
11 Correct 31 ms 2068 KB Output is correct
12 Correct 28 ms 1776 KB Output is correct
13 Correct 28 ms 1812 KB Output is correct
14 Correct 28 ms 1784 KB Output is correct
15 Correct 31 ms 1808 KB Output is correct
16 Correct 27 ms 1780 KB Output is correct
17 Correct 31 ms 1864 KB Output is correct
18 Correct 26 ms 1936 KB Output is correct
19 Correct 26 ms 1712 KB Output is correct
20 Correct 27 ms 1888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 15 ms 1156 KB Output is correct
3 Correct 17 ms 1428 KB Output is correct
4 Correct 27 ms 1808 KB Output is correct
5 Correct 27 ms 1892 KB Output is correct
6 Correct 27 ms 1884 KB Output is correct
7 Correct 27 ms 1728 KB Output is correct
8 Correct 27 ms 1812 KB Output is correct
9 Correct 26 ms 1832 KB Output is correct
10 Correct 25 ms 1764 KB Output is correct
11 Correct 31 ms 2068 KB Output is correct
12 Correct 28 ms 1776 KB Output is correct
13 Correct 28 ms 1812 KB Output is correct
14 Correct 28 ms 1784 KB Output is correct
15 Correct 31 ms 1808 KB Output is correct
16 Correct 27 ms 1780 KB Output is correct
17 Correct 31 ms 1864 KB Output is correct
18 Correct 26 ms 1936 KB Output is correct
19 Correct 26 ms 1712 KB Output is correct
20 Correct 27 ms 1888 KB Output is correct
21 Correct 32 ms 2120 KB Output is correct
22 Correct 32 ms 2136 KB Output is correct
23 Correct 32 ms 2132 KB Output is correct
24 Correct 32 ms 2132 KB Output is correct
25 Correct 32 ms 2156 KB Output is correct
26 Correct 31 ms 2124 KB Output is correct
27 Correct 30 ms 2132 KB Output is correct
28 Correct 31 ms 1808 KB Output is correct
29 Correct 32 ms 1808 KB Output is correct
30 Correct 28 ms 1816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 15 ms 1156 KB Output is correct
3 Correct 17 ms 1428 KB Output is correct
4 Correct 27 ms 1808 KB Output is correct
5 Correct 27 ms 1892 KB Output is correct
6 Correct 27 ms 1884 KB Output is correct
7 Correct 27 ms 1728 KB Output is correct
8 Correct 27 ms 1812 KB Output is correct
9 Correct 26 ms 1832 KB Output is correct
10 Correct 25 ms 1764 KB Output is correct
11 Correct 31 ms 2068 KB Output is correct
12 Correct 28 ms 1776 KB Output is correct
13 Correct 28 ms 1812 KB Output is correct
14 Correct 28 ms 1784 KB Output is correct
15 Correct 31 ms 1808 KB Output is correct
16 Correct 27 ms 1780 KB Output is correct
17 Correct 31 ms 1864 KB Output is correct
18 Correct 26 ms 1936 KB Output is correct
19 Correct 26 ms 1712 KB Output is correct
20 Correct 27 ms 1888 KB Output is correct
21 Correct 32 ms 2120 KB Output is correct
22 Correct 32 ms 2136 KB Output is correct
23 Correct 32 ms 2132 KB Output is correct
24 Correct 32 ms 2132 KB Output is correct
25 Correct 32 ms 2156 KB Output is correct
26 Correct 31 ms 2124 KB Output is correct
27 Correct 30 ms 2132 KB Output is correct
28 Correct 31 ms 1808 KB Output is correct
29 Correct 32 ms 1808 KB Output is correct
30 Correct 28 ms 1816 KB Output is correct
31 Incorrect 40 ms 2484 KB Output isn't correct
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 3452 KB Output isn't correct
2 Halted 0 ms 0 KB -