Submission #1078415

# Submission time Handle Problem Language Result Execution time Memory
1078415 2024-08-27T16:53:08 Z anton Broken Device (JOI17_broken_device) C++17
41 / 100
28 ms 2608 KB
#include "Annalib.h"
#include<bits/stdc++.h>

using namespace std;
#define ll long long 

int N;
ll X;

void Anna( int _N, long long _X, int K, int P[] ){
  N = _N;
  X = _X;
  vector<int> info_bits;
  while(X>0){
    info_bits.push_back(X%2LL);
    X/=2LL;
  }

  /*for(auto e: info_bits){
    cout<<e<<" ";
  }
  cout<<endl;*/

  vector<bool> broken(N, false);
  for(int i = 0; i<K; i++){
    broken[P[i]] = true;
  }
  

  vector<int> res(N);
  auto mySet = [&](int pos, int val){
    if(pos<N){
      res[pos] = val;
    }
  };
  int cur_id = 0;
  for(int i = 0; i<info_bits.size(); i++){
    while(broken[cur_id] || broken[cur_id+1]){
      cur_id++;
    }
    mySet(cur_id, 1);
    mySet(cur_id+1, info_bits[i]);
    cur_id+=2;
  }

  for(int i = 0; i<N; i++){
    Set(i, res[i]);
  }
  

}
#include "Brunolib.h"
#include<bits/stdc++.h>

using namespace std;
#define ll long long 

long long Bruno( int N, int A[] ){
  vector<ll> bits;
  for(int i = 0; i<N; i++){
    if(A[i]>0){
      bits.push_back(A[i+1]);
      i++;
    }
  }
  ll res= 0;
 
  reverse(bits.begin(), bits.end());
  /*for(auto e: bits){
    cout<<e<<" ";
  }
  cout<<endl;*/
  for(ll i = 0; i<bits.size(); i++){
    res = res * 2LL + bits[i];
  }
  return res;

}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:37:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for(int i = 0; i<info_bits.size(); i++){
      |                  ~^~~~~~~~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:22:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for(ll i = 0; i<bits.size(); i++){
      |                 ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 20 ms 2400 KB Output is partially correct - L* = 15
2 Partially correct 20 ms 2608 KB Output is partially correct - L* = 15
3 Partially correct 20 ms 2416 KB Output is partially correct - L* = 17
4 Partially correct 22 ms 2388 KB Output is partially correct - L* = 16
5 Partially correct 20 ms 2392 KB Output is partially correct - L* = 15
6 Partially correct 22 ms 2396 KB Output is partially correct - L* = 15
7 Partially correct 20 ms 2392 KB Output is partially correct - L* = 18
8 Partially correct 20 ms 2396 KB Output is partially correct - L* = 18
9 Partially correct 20 ms 2404 KB Output is partially correct - L* = 16
10 Partially correct 22 ms 2480 KB Output is partially correct - L* = 16
11 Partially correct 27 ms 2488 KB Output is partially correct - L* = 17
12 Partially correct 23 ms 2392 KB Output is partially correct - L* = 17
13 Partially correct 22 ms 2584 KB Output is partially correct - L* = 15
14 Partially correct 22 ms 2396 KB Output is partially correct - L* = 15
15 Partially correct 20 ms 2396 KB Output is partially correct - L* = 16
16 Partially correct 20 ms 2396 KB Output is partially correct - L* = 15
17 Partially correct 22 ms 2396 KB Output is partially correct - L* = 17
18 Partially correct 20 ms 2400 KB Output is partially correct - L* = 16
19 Partially correct 26 ms 2308 KB Output is partially correct - L* = 18
20 Partially correct 20 ms 2496 KB Output is partially correct - L* = 15
21 Partially correct 22 ms 2396 KB Output is partially correct - L* = 15
22 Partially correct 23 ms 2396 KB Output is partially correct - L* = 15
23 Partially correct 23 ms 2392 KB Output is partially correct - L* = 15
24 Partially correct 23 ms 2372 KB Output is partially correct - L* = 17
25 Partially correct 23 ms 2476 KB Output is partially correct - L* = 15
26 Partially correct 22 ms 2396 KB Output is partially correct - L* = 16
27 Partially correct 20 ms 2396 KB Output is partially correct - L* = 15
28 Partially correct 20 ms 2392 KB Output is partially correct - L* = 16
29 Partially correct 20 ms 2504 KB Output is partially correct - L* = 15
30 Partially correct 20 ms 2392 KB Output is partially correct - L* = 16
31 Partially correct 23 ms 2396 KB Output is partially correct - L* = 15
32 Partially correct 28 ms 2396 KB Output is partially correct - L* = 16
33 Partially correct 20 ms 2488 KB Output is partially correct - L* = 15
34 Partially correct 23 ms 2396 KB Output is partially correct - L* = 16
35 Partially correct 22 ms 2396 KB Output is partially correct - L* = 15
36 Partially correct 22 ms 2396 KB Output is partially correct - L* = 15
37 Partially correct 22 ms 2368 KB Output is partially correct - L* = 16
38 Partially correct 22 ms 2372 KB Output is partially correct - L* = 17
39 Partially correct 20 ms 2392 KB Output is partially correct - L* = 15
40 Partially correct 23 ms 2396 KB Output is partially correct - L* = 15