답안 #70155

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70155 2018-08-22T11:56:20 Z Just_Solve_The_Problem Broken Device (JOI17_broken_device) C++11
0 / 100
76 ms 12992 KB
#include <bits/stdc++.h>
#include "Annalib.h"
//#include "grader.cpp"

#define pb push_back

using namespace std;

void Anna( int N, long long X, int K, int P[] ){
  vector < int > used(N, 0);
  vector < int > u(N, 0);
  for (int i = 0; i < K; i++) {
    used[P[i]] = 1;
  }
  vector < int > p;
  for (int i = 0; i < 61; i++) {
    p.pb((X >> i) & 1);
  }
  vector < int > vec;
  int res = 1;
  for (int i = 1; i < 61; i++) {
    if (p[i] != p[i - 1]) {
      vec.pb(res);
      res = 0;
    }
    res++;
  }
  vec.pb(res);
  int cur = 0;
  for (int i = 1; i < K && cur < vec.size(); i++) {
    if (P[i] - 1 - P[i - 1] >= vec[cur]) {
      for (int j = P[i - 1] + 1; j < P[i - 1] + 1 + vec[cur]; j++) {
        u[j] = 1;
      }
      cur++;
      P[i - 1] += 1 + vec[cur];
      i--;
    }
  }
  for (int i = 0; i < N; i++) {
    Set(i, u[i]);
  }
}
#include <bits/stdc++.h>
#include "Brunolib.h"
//#include "grader.cpp"

#define ll long long
#define pb push_back

using namespace std;

long long Bruno( int N, int A[] ){
  ll ret = 0;
  int cur = 60;
  vector < int > vec;
  int res = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 1) {
      res++;
    } else {
      if (res) {
        vec.pb(res);
      }
      res = 0;
    }
  }
  if (res)
    vec.pb(res);
  reverse(vec.begin(), vec.end());
  for (int i = 0; i < vec.size(); i++) {
    if (i & 1) {
      for (int j = 0; j < vec.size(); j++) {
        ret |= (1LL << cur);
        cur--;
      }
    } else {
      cur -= vec.size();
    }
  }
  return ret;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:30:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 1; i < K && cur < vec.size(); i++) {
                            ~~~~^~~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:28:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < vec.size(); i++) {
                   ~~^~~~~~~~~~~~
Bruno.cpp:30:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int j = 0; j < vec.size(); j++) {
                       ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 3320 KB Output isn't correct - L* = 0
2 Incorrect 76 ms 3864 KB Output isn't correct - L* = 0
3 Incorrect 67 ms 4144 KB Output isn't correct - L* = 0
4 Incorrect 55 ms 4312 KB Output isn't correct - L* = 0
5 Incorrect 76 ms 4848 KB Output isn't correct - L* = 0
6 Incorrect 6 ms 4848 KB Unexpected end of file - int64 expected
7 Incorrect 62 ms 4968 KB Output isn't correct - L* = 0
8 Incorrect 48 ms 5232 KB Output isn't correct - L* = 0
9 Incorrect 59 ms 5472 KB Output isn't correct - L* = 0
10 Incorrect 66 ms 5720 KB Output isn't correct - L* = 0
11 Incorrect 46 ms 5968 KB Output isn't correct - L* = 0
12 Incorrect 51 ms 6200 KB Output isn't correct - L* = 0
13 Incorrect 63 ms 6456 KB Output isn't correct - L* = 0
14 Incorrect 52 ms 6680 KB Output isn't correct - L* = 0
15 Incorrect 49 ms 6920 KB Output isn't correct - L* = 0
16 Incorrect 9 ms 6920 KB Unexpected end of file - int64 expected
17 Incorrect 47 ms 7400 KB Output isn't correct - L* = 0
18 Incorrect 53 ms 7640 KB Output isn't correct - L* = 0
19 Incorrect 57 ms 7896 KB Output isn't correct - L* = 0
20 Incorrect 6 ms 7896 KB Unexpected end of file - int64 expected
21 Incorrect 50 ms 8384 KB Output isn't correct - L* = 0
22 Incorrect 11 ms 8384 KB Unexpected end of file - int64 expected
23 Incorrect 63 ms 8832 KB Output isn't correct - L* = 0
24 Incorrect 56 ms 9080 KB Output isn't correct - L* = 0
25 Incorrect 54 ms 9328 KB Output isn't correct - L* = 0
26 Incorrect 54 ms 9576 KB Output isn't correct - L* = 0
27 Incorrect 54 ms 9832 KB Output isn't correct - L* = 0
28 Incorrect 52 ms 10072 KB Output isn't correct - L* = 0
29 Incorrect 51 ms 10304 KB Output isn't correct - L* = 0
30 Incorrect 49 ms 10552 KB Output isn't correct - L* = 0
31 Incorrect 50 ms 10800 KB Output isn't correct - L* = 0
32 Incorrect 56 ms 11064 KB Output isn't correct - L* = 0
33 Incorrect 60 ms 11288 KB Output isn't correct - L* = 0
34 Incorrect 50 ms 11536 KB Output isn't correct - L* = 0
35 Incorrect 51 ms 11768 KB Output isn't correct - L* = 0
36 Incorrect 51 ms 12016 KB Output isn't correct - L* = 0
37 Incorrect 58 ms 12264 KB Output isn't correct - L* = 0
38 Incorrect 55 ms 12512 KB Output isn't correct - L* = 0
39 Incorrect 55 ms 12752 KB Output isn't correct - L* = 0
40 Incorrect 48 ms 12992 KB Output isn't correct - L* = 0