Submission #1078400

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

using namespace std;
#define ll long long 

int N;
ll X;
void mySet(int pos, int val){
  if(pos<N){
  Set(pos, val);
  }
}
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;
  }

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

  int cur_id = 0;
  for(int i = 0; i<info_bits.size(); i++){
    while(broken[cur_id] || broken[cur_id+1]){
      mySet(cur_id, 0);
      cur_id++;
    }
    mySet(cur_id, 1);
    mySet(cur_id+1, info_bits[i]);
    cur_id+=2;
  }

  while(cur_id<N){
    mySet(cur_id, 0);
    cur_id++;
  }

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

using namespace std;
#define ll long long 

long long Bruno( int N, int A[] ){
  vector<int> bits;
  for(int i = 0; i<N; i++){
    if(A[i]>0){
      bits.push_back(A[i+1]);
      i+=2;
    }
  }
  ll res= 0;

  for(ll i = 0; i<bits.size(); i++){
    if(bits[i]>0){
      res |= (1LL<<i);
    }
  }
  return res;

}

Compilation message

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

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:17:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(ll i = 0; i<bits.size(); i++){
      |                 ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 25 ms 2780 KB Output isn't correct - L* = 0
2 Partially correct 20 ms 2904 KB Output isn't correct - L* = 0
3 Partially correct 22 ms 2696 KB Output isn't correct - L* = 0
4 Partially correct 20 ms 2772 KB Output isn't correct - L* = 0
5 Partially correct 22 ms 2868 KB Output isn't correct - L* = 0
6 Partially correct 23 ms 2752 KB Output isn't correct - L* = 0
7 Partially correct 20 ms 2776 KB Output isn't correct - L* = 0
8 Partially correct 20 ms 2784 KB Output isn't correct - L* = 0
9 Partially correct 23 ms 2868 KB Output isn't correct - L* = 0
10 Partially correct 20 ms 2776 KB Output isn't correct - L* = 0
11 Partially correct 22 ms 2780 KB Output isn't correct - L* = 0
12 Partially correct 20 ms 2776 KB Output isn't correct - L* = 0
13 Partially correct 23 ms 2864 KB Output isn't correct - L* = 0
14 Partially correct 26 ms 2772 KB Output isn't correct - L* = 0
15 Partially correct 30 ms 2748 KB Output isn't correct - L* = 0
16 Partially correct 20 ms 2860 KB Output isn't correct - L* = 0
17 Partially correct 20 ms 2856 KB Output isn't correct - L* = 0
18 Partially correct 20 ms 2772 KB Output isn't correct - L* = 0
19 Partially correct 20 ms 2776 KB Output isn't correct - L* = 0
20 Partially correct 20 ms 2784 KB Output isn't correct - L* = 0
21 Partially correct 20 ms 2748 KB Output isn't correct - L* = 0
22 Partially correct 22 ms 2772 KB Output isn't correct - L* = 0
23 Partially correct 20 ms 2780 KB Output isn't correct - L* = 0
24 Partially correct 23 ms 2776 KB Output isn't correct - L* = 0
25 Partially correct 23 ms 2660 KB Output isn't correct - L* = 0
26 Partially correct 20 ms 2776 KB Output isn't correct - L* = 0
27 Partially correct 20 ms 2784 KB Output isn't correct - L* = 0
28 Partially correct 22 ms 2744 KB Output isn't correct - L* = 0
29 Partially correct 26 ms 2772 KB Output isn't correct - L* = 0
30 Partially correct 20 ms 2776 KB Output isn't correct - L* = 0
31 Partially correct 25 ms 2688 KB Output isn't correct - L* = 0
32 Partially correct 22 ms 3028 KB Output isn't correct - L* = 0
33 Partially correct 22 ms 2748 KB Output isn't correct - L* = 0
34 Partially correct 20 ms 2828 KB Output isn't correct - L* = 0
35 Partially correct 22 ms 2856 KB Output isn't correct - L* = 0
36 Partially correct 23 ms 2784 KB Output isn't correct - L* = 0
37 Partially correct 20 ms 2872 KB Output isn't correct - L* = 0
38 Partially correct 22 ms 2772 KB Output isn't correct - L* = 0
39 Partially correct 20 ms 2808 KB Output isn't correct - L* = 0
40 Partially correct 20 ms 2872 KB Output isn't correct - L* = 0