답안 #1078413

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078413 2024-08-27T16:52:33 Z anton Broken Device (JOI17_broken_device) C++17
0 / 100
27 ms 2764 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];
  }
  cout<<res<<endl;
  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++){
      |                 ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
2 Incorrect 24 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
3 Incorrect 22 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
4 Incorrect 23 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
5 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
6 Incorrect 27 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
7 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
8 Incorrect 24 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
9 Incorrect 26 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
10 Incorrect 22 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
11 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
12 Incorrect 23 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
13 Incorrect 23 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
14 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
15 Incorrect 22 ms 2400 KB Program terminated incorrectly, or you printed something to stdout
16 Incorrect 22 ms 2504 KB Program terminated incorrectly, or you printed something to stdout
17 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
18 Incorrect 24 ms 2764 KB Program terminated incorrectly, or you printed something to stdout
19 Incorrect 23 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
20 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
21 Incorrect 23 ms 2480 KB Program terminated incorrectly, or you printed something to stdout
22 Incorrect 25 ms 2452 KB Program terminated incorrectly, or you printed something to stdout
23 Incorrect 27 ms 2492 KB Program terminated incorrectly, or you printed something to stdout
24 Incorrect 24 ms 2308 KB Program terminated incorrectly, or you printed something to stdout
25 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
26 Incorrect 23 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
27 Incorrect 23 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
28 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
29 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
30 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
31 Incorrect 24 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
32 Incorrect 23 ms 2612 KB Program terminated incorrectly, or you printed something to stdout
33 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
34 Incorrect 24 ms 2480 KB Program terminated incorrectly, or you printed something to stdout
35 Incorrect 23 ms 2496 KB Program terminated incorrectly, or you printed something to stdout
36 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
37 Incorrect 23 ms 2488 KB Program terminated incorrectly, or you printed something to stdout
38 Incorrect 23 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
39 Incorrect 23 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
40 Incorrect 24 ms 2404 KB Program terminated incorrectly, or you printed something to stdout