답안 #70560

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70560 2018-08-23T06:12:46 Z Talant Broken Device (JOI17_broken_device) C++17
0 / 100
6 ms 1400 KB
#include "Annalib.h"

#include <bits/stdc++.h>

#define sc second
#define fr first
#define pb push_back
#define mk make_pair

using namespace std;

string bin(long long x) {
      string a = "";
      while(x) {
            a += (char)(x % 2 + '0');
            x /= 2;
      }
      return a;
}
int u[200];
int ind;

void Anna( int n, long long x, int k, int p[] ){
      string s = bin(x);
      memset(u,0,sizeof(u));
      ind = 0;

      for (int i = 0; i < k; i ++)
            u[p[i]] = 1;

      for (int i = 0; i < n; i ++) {
            if (ind >= (int)s.size()) {
                  Set(i,0);
                  continue;
            }
            if (i + 1 < n && u[i] + u[i + 1] < 1) {
                  Set(i,1);
                  Set(i + 1,(int)(s[ind] - '0'));
                  ind ++;
                  i ++;
                  while (s[ind - 1] == '1' && s[ind] == '1' && ind < (int)s.size() && u[i + 1] == 0) {
                        Set(i + 1,(int)(s[ind] - '0'));
                        ind ++;
                        i ++;
                  }
                  i ++;
                  Set(i,0);
            }
            else {
                  Set(i,0);
            }
      }
}
#include "Brunolib.h"

#include <bits/stdc++.h>

#define sc second
#define fr first
#define pb push_back
#define mk make_pair

using namespace std;

long long ans;
long long cnt;

long long Bruno( int N, int a[] ){
      ans = 0;
      cnt = 0;

      for (int i = 0; i < N - 1; i ++) {
            if (a[i] == 1) {
                  ans += (1ll << cnt) * 1ll *  a[i + 1];
//                  cout << i + 1 << endl;
                  cnt ++;
                  i ++;
                  while (a[i] == 1 && a[i + 1] == 1 && i + 1 < N) {
                        ans += (1ll << cnt) * 1ll *  a[i + 1];
//                        cout << i + 1 << endl;
                        cnt ++;
                        i ++;
                  }
            }
      }
      return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 768 KB Wrong Answer [1]
2 Incorrect 4 ms 1280 KB Wrong Answer [1]
3 Incorrect 5 ms 1288 KB Wrong Answer [1]
4 Incorrect 6 ms 1312 KB Wrong Answer [1]
5 Incorrect 5 ms 1368 KB Wrong Answer [1]
6 Incorrect 4 ms 1372 KB Wrong Answer [1]
7 Incorrect 4 ms 1376 KB Wrong Answer [1]
8 Incorrect 4 ms 1376 KB Wrong Answer [1]
9 Incorrect 4 ms 1376 KB Wrong Answer [1]
10 Incorrect 4 ms 1376 KB Wrong Answer [1]
11 Incorrect 5 ms 1376 KB Wrong Answer [1]
12 Incorrect 4 ms 1376 KB Wrong Answer [1]
13 Incorrect 4 ms 1376 KB Wrong Answer [1]
14 Incorrect 5 ms 1376 KB Wrong Answer [1]
15 Incorrect 6 ms 1376 KB Wrong Answer [1]
16 Incorrect 5 ms 1376 KB Wrong Answer [1]
17 Incorrect 4 ms 1376 KB Wrong Answer [1]
18 Incorrect 5 ms 1376 KB Wrong Answer [1]
19 Incorrect 6 ms 1376 KB Wrong Answer [1]
20 Incorrect 4 ms 1376 KB Wrong Answer [1]
21 Incorrect 6 ms 1376 KB Wrong Answer [1]
22 Incorrect 4 ms 1376 KB Wrong Answer [1]
23 Incorrect 5 ms 1376 KB Wrong Answer [1]
24 Incorrect 6 ms 1376 KB Wrong Answer [1]
25 Incorrect 5 ms 1376 KB Wrong Answer [1]
26 Incorrect 5 ms 1376 KB Wrong Answer [1]
27 Incorrect 5 ms 1376 KB Wrong Answer [1]
28 Incorrect 4 ms 1376 KB Wrong Answer [1]
29 Incorrect 4 ms 1376 KB Wrong Answer [1]
30 Incorrect 5 ms 1376 KB Wrong Answer [1]
31 Incorrect 4 ms 1376 KB Wrong Answer [1]
32 Incorrect 5 ms 1376 KB Wrong Answer [1]
33 Incorrect 4 ms 1400 KB Wrong Answer [1]
34 Incorrect 4 ms 1400 KB Wrong Answer [1]
35 Incorrect 5 ms 1400 KB Wrong Answer [1]
36 Incorrect 4 ms 1400 KB Wrong Answer [1]
37 Incorrect 4 ms 1400 KB Wrong Answer [1]
38 Incorrect 5 ms 1400 KB Wrong Answer [1]
39 Incorrect 5 ms 1400 KB Wrong Answer [1]
40 Incorrect 5 ms 1400 KB Wrong Answer [1]