답안 #1078404

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078404 2024-08-27T16:43:17 Z anton Broken Device (JOI17_broken_device) C++17
0 / 100
5 ms 2136 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;
  }
  

  vector<int> res(N);
  int cur_id = 0;
  for(int i = 0; i<info_bits.size(); i++){
    while(broken[cur_id] || broken[cur_id+1]){
      cur_id++;
    }
    res[cur_id] = 1;
    res[cur_id+1] = info_bits[i];
    cur_id+=2;
  }

  for(int i = 0; i<N; i++){
    mySet(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<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:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   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++){
      |                 ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2136 KB Execution killed with signal 6
2 Runtime error 1 ms 604 KB Execution killed with signal 6
3 Runtime error 1 ms 600 KB Execution killed with signal 6
4 Runtime error 4 ms 1884 KB Execution killed with signal 6
5 Runtime error 4 ms 1884 KB Execution killed with signal 6
6 Runtime error 4 ms 1884 KB Execution killed with signal 6
7 Runtime error 4 ms 1892 KB Execution killed with signal 6
8 Runtime error 1 ms 604 KB Execution killed with signal 6
9 Runtime error 4 ms 1884 KB Execution killed with signal 6
10 Runtime error 4 ms 1884 KB Execution killed with signal 6
11 Runtime error 4 ms 1880 KB Execution killed with signal 6
12 Runtime error 4 ms 1884 KB Execution killed with signal 6
13 Runtime error 4 ms 1796 KB Execution killed with signal 6
14 Runtime error 1 ms 604 KB Execution killed with signal 6
15 Runtime error 4 ms 1884 KB Execution killed with signal 6
16 Runtime error 4 ms 1880 KB Execution killed with signal 6
17 Runtime error 4 ms 1884 KB Execution killed with signal 6
18 Runtime error 4 ms 1884 KB Execution killed with signal 6
19 Runtime error 4 ms 1884 KB Execution killed with signal 6
20 Runtime error 4 ms 1884 KB Execution killed with signal 6
21 Runtime error 5 ms 1884 KB Execution killed with signal 6
22 Runtime error 4 ms 1880 KB Execution killed with signal 6
23 Runtime error 4 ms 1884 KB Execution killed with signal 6
24 Runtime error 4 ms 1736 KB Execution killed with signal 6
25 Runtime error 4 ms 1880 KB Execution killed with signal 6
26 Runtime error 1 ms 604 KB Execution killed with signal 6
27 Runtime error 4 ms 1732 KB Execution killed with signal 6
28 Runtime error 4 ms 1884 KB Execution killed with signal 6
29 Runtime error 5 ms 1640 KB Execution killed with signal 6
30 Runtime error 4 ms 1660 KB Execution killed with signal 6
31 Runtime error 1 ms 600 KB Execution killed with signal 6
32 Runtime error 4 ms 1880 KB Execution killed with signal 6
33 Runtime error 5 ms 1884 KB Execution killed with signal 6
34 Runtime error 4 ms 1884 KB Execution killed with signal 6
35 Runtime error 4 ms 1884 KB Execution killed with signal 6
36 Runtime error 4 ms 1884 KB Execution killed with signal 6
37 Runtime error 4 ms 1880 KB Execution killed with signal 6
38 Runtime error 4 ms 1592 KB Execution killed with signal 6
39 Runtime error 4 ms 1628 KB Execution killed with signal 6
40 Runtime error 5 ms 1548 KB Execution killed with signal 6