Submission #934819

# Submission time Handle Problem Language Result Execution time Memory
934819 2024-02-28T04:41:32 Z nguyentunglam Broken Device 2 (JOI22_device2) C++17
0 / 100
55 ms 4380 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);
  }

  for(int &j : s) cout << j; cout << endl;
  for(int &j : t) cout << j; cout << endl;

  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: In function 'std::pair<std::vector<int>, std::vector<int> > Anna(long long int)':
Anna.cpp:29:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   29 |   for(int &j : s) cout << j; cout << endl;
      |   ^~~
Anna.cpp:29:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   29 |   for(int &j : s) cout << j; cout << endl;
      |                              ^~~~
Anna.cpp:30:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |   for(int &j : t) cout << j; cout << endl;
      |   ^~~
Anna.cpp:30:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 |   for(int &j : t) cout << j; cout << endl;
      |                              ^~~~
Anna.cpp: At global scope:
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;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 796 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 796 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 796 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 796 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 796 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 4380 KB Do not print anything to stdout
2 Halted 0 ms 0 KB -