답안 #1078412

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078412 2024-08-27T16:51:52 Z anton Broken Device (JOI17_broken_device) C++17
0 / 100
19 ms 2680 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;
  cout<<X<<endl;
  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:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   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 15 ms 2668 KB Unexpected end of file - int64 expected
2 Incorrect 19 ms 2672 KB Unexpected end of file - int64 expected
3 Incorrect 14 ms 2676 KB Unexpected end of file - int64 expected
4 Runtime error 14 ms 2668 KB Execution killed with signal 11
5 Runtime error 16 ms 2664 KB Execution killed with signal 11
6 Runtime error 15 ms 2668 KB Execution killed with signal 11
7 Runtime error 14 ms 2668 KB Execution killed with signal 11
8 Runtime error 14 ms 2680 KB Execution killed with signal 11
9 Incorrect 13 ms 2676 KB Unexpected end of file - int64 expected
10 Runtime error 15 ms 2664 KB Execution killed with signal 11
11 Incorrect 14 ms 2676 KB Unexpected end of file - int64 expected
12 Runtime error 16 ms 2668 KB Execution killed with signal 11
13 Runtime error 17 ms 2552 KB Execution killed with signal 11
14 Incorrect 15 ms 2668 KB Unexpected end of file - int64 expected
15 Incorrect 15 ms 2540 KB Unexpected end of file - int64 expected
16 Incorrect 14 ms 2616 KB Unexpected end of file - int64 expected
17 Incorrect 14 ms 2664 KB Unexpected end of file - int64 expected
18 Runtime error 16 ms 2668 KB Execution killed with signal 11
19 Runtime error 14 ms 2672 KB Execution killed with signal 11
20 Incorrect 14 ms 2644 KB Unexpected end of file - int64 expected
21 Incorrect 14 ms 2668 KB Unexpected end of file - int64 expected
22 Incorrect 15 ms 2672 KB Unexpected end of file - int64 expected
23 Incorrect 16 ms 2484 KB Unexpected end of file - int64 expected
24 Runtime error 14 ms 2656 KB Execution killed with signal 11
25 Incorrect 14 ms 2668 KB Unexpected end of file - int64 expected
26 Runtime error 15 ms 2668 KB Execution killed with signal 11
27 Incorrect 14 ms 2644 KB Unexpected end of file - int64 expected
28 Incorrect 15 ms 2668 KB Unexpected end of file - int64 expected
29 Incorrect 14 ms 2672 KB Unexpected end of file - int64 expected
30 Incorrect 15 ms 2672 KB Unexpected end of file - int64 expected
31 Runtime error 16 ms 2528 KB Execution killed with signal 11
32 Incorrect 15 ms 2676 KB Unexpected end of file - int64 expected
33 Incorrect 14 ms 2672 KB Unexpected end of file - int64 expected
34 Runtime error 14 ms 2668 KB Execution killed with signal 11
35 Incorrect 14 ms 2664 KB Unexpected end of file - int64 expected
36 Incorrect 14 ms 2668 KB Unexpected end of file - int64 expected
37 Runtime error 15 ms 2668 KB Execution killed with signal 11
38 Runtime error 14 ms 2664 KB Execution killed with signal 11
39 Incorrect 14 ms 2668 KB Unexpected end of file - int64 expected
40 Runtime error 15 ms 2664 KB Execution killed with signal 11