답안 #718820

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
718820 2023-04-05T00:15:16 Z Hacv16 Broken Device (JOI17_broken_device) C++17
0 / 100
1 ms 468 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

void Anna(int N, ll X, int K, int P[]){
    vector<bool> blocked(N);

    for(int i = 0; i < K; i++){
        int curBit = P[i];
        blocked[curBit] = true;
    }

    int numFree = 0;

    for(int i = 0; i < N; i++){
        if(!blocked[i]){ numFree++; continue; }

        if(numFree % 2) blocked[i - 1] = true;
        blocked[i] = true; numFree = 0;
    }

    vector<int> goodPos;

    for(int i = 0; i < N; i++){
        if(blocked[i]) Set(i, 0);
        else goodPos.push_back(i);
    }

    assert(goodPos.size() % 2 == 0);

    for(int i = 0, j = 0; i < goodPos.size(); i += 2, j++){
        int pos1 = goodPos[i], pos2 = goodPos[i + 1];

        int bitOn = (bool)((1 << j) & X);
        Set(pos1, 1); Set(pos2, bitOn);
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>

typedef long long ll;

ll Bruno(int N, int A[]){
  ll ans = 0;

  for(int i = 0, j = 0; i < N; i += 2){
    if(A[i] == 0) continue;
    ans |= (A[i + 1] << j); j++;
  }

  return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, ll, int, int*)':
Anna.cpp:33:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i = 0, j = 0; i < goodPos.size(); i += 2, j++){
      |                           ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Runtime error 1 ms 468 KB Execution killed with signal 6
4 Runtime error 1 ms 468 KB Execution killed with signal 6
5 Runtime error 1 ms 468 KB Execution killed with signal 6
6 Runtime error 1 ms 468 KB Execution killed with signal 6
7 Runtime error 1 ms 468 KB Execution killed with signal 6
8 Runtime error 1 ms 468 KB Execution killed with signal 6
9 Runtime error 1 ms 468 KB Execution killed with signal 6
10 Runtime error 1 ms 468 KB Execution killed with signal 6
11 Runtime error 1 ms 468 KB Execution killed with signal 6
12 Runtime error 1 ms 468 KB Execution killed with signal 6
13 Runtime error 1 ms 468 KB Execution killed with signal 6
14 Runtime error 1 ms 468 KB Execution killed with signal 6
15 Runtime error 1 ms 468 KB Execution killed with signal 6
16 Runtime error 1 ms 468 KB Execution killed with signal 6
17 Runtime error 1 ms 468 KB Execution killed with signal 6
18 Runtime error 1 ms 468 KB Execution killed with signal 6
19 Runtime error 1 ms 468 KB Execution killed with signal 6
20 Runtime error 1 ms 468 KB Execution killed with signal 6
21 Runtime error 1 ms 468 KB Execution killed with signal 6
22 Runtime error 1 ms 468 KB Execution killed with signal 6
23 Runtime error 1 ms 468 KB Execution killed with signal 6
24 Runtime error 1 ms 468 KB Execution killed with signal 6
25 Runtime error 1 ms 468 KB Execution killed with signal 6
26 Runtime error 1 ms 468 KB Execution killed with signal 6
27 Runtime error 1 ms 468 KB Execution killed with signal 6
28 Runtime error 1 ms 468 KB Execution killed with signal 6
29 Runtime error 1 ms 468 KB Execution killed with signal 6
30 Runtime error 1 ms 468 KB Execution killed with signal 6
31 Runtime error 1 ms 468 KB Execution killed with signal 6
32 Runtime error 1 ms 468 KB Execution killed with signal 6
33 Runtime error 1 ms 468 KB Execution killed with signal 6
34 Runtime error 1 ms 468 KB Execution killed with signal 6
35 Runtime error 1 ms 468 KB Execution killed with signal 6
36 Runtime error 1 ms 468 KB Execution killed with signal 6
37 Runtime error 1 ms 468 KB Execution killed with signal 6
38 Runtime error 1 ms 468 KB Execution killed with signal 6
39 Runtime error 1 ms 468 KB Execution killed with signal 6
40 Runtime error 1 ms 468 KB Execution killed with signal 6