답안 #21548

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
21548 2017-04-14T08:54:58 Z Ushio Broken Device (JOI17_broken_device) C++14
0 / 100
76 ms 4644 KB
#include "Annalib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;

const int FCT = 3;

void Anna( int N, long long X, int K, int P[] ){
    vector<int> per(N + FCT);
    srand(241417941L);
    for (int i = 0; i < N + FCT; ++i) {
        per[i] = i;
    }
    for (int i = 0; i < N; ++i) {
        int pos = i + rand() % (N - i);
        swap(per[i], per[pos]);
    }
    int bit = 0;
    int validity = 0;
    vector<bool> bad(N + FCT, false);
    for (int i = 0; i < FCT; ++i) {
        bad[per[N + i]] = true;
    }
    for (int i = 0; i < K; ++i) {
        bad[P[i]] = true;
    }
    for (int i = 0; i < N; ++i) {
        if (validity == 0) {
            bool ok = false;
            for (int j = 0; j <= FCT; ++j) {
                ok |= bad[per[i + j]];
            }
            if (ok) {
                Set(per[i], 0);
                validity = 0;
            } else {
                Set(per[i], 1);
                validity = FCT;
            }
        } else {
            if (bit <= 59) {
                if (X & (1LL << bit)) {
                    Set(per[i], 1);
                } else {
                    Set(per[i], 0);
                }
                bit++;
            } else {
                Set(per[i], 0);
            }
            validity--;
        }
    }
    cerr << "In: " << X << endl;
}
#include "Brunolib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;

const int FCT = 2;

long long Bruno( int N, int A[] ){
    vector<int> per(N + 1);
    srand(141417941L);
    for (int i = 0; i < N + 1; ++i) {
        per[i] = i;
    }
    for (int i = 0; i < N; ++i) {
        int pos = i + rand() % (N - i);
        swap(per[i], per[pos]);
    }
    int validity = 0;
    int bit = 0;
    int64_t ans = 0;
    for (int i = 0; i < N; ++i) {
        if (validity == 0) {
            validity = A[per[i]] * FCT;
        } else {
            if (bit <= 59) {
                ans |= ((int64_t) A[per[i]]) << bit;
                ++bit;
            }
            validity--;
        }
    }
    cerr << "Out: " << ans << endl;
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 46 ms 4644 KB Output isn't correct - L* = 0
2 Incorrect 48 ms 4644 KB Output isn't correct - L* = 0
3 Incorrect 58 ms 4644 KB Output isn't correct - L* = 0
4 Incorrect 52 ms 4644 KB Output isn't correct - L* = 0
5 Incorrect 49 ms 4644 KB Output isn't correct - L* = 0
6 Incorrect 46 ms 4644 KB Output isn't correct - L* = 0
7 Incorrect 49 ms 4644 KB Output isn't correct - L* = 0
8 Incorrect 48 ms 4644 KB Output isn't correct - L* = 0
9 Incorrect 49 ms 4644 KB Output isn't correct - L* = 0
10 Incorrect 59 ms 4644 KB Output isn't correct - L* = 0
11 Incorrect 75 ms 4644 KB Output isn't correct - L* = 0
12 Incorrect 75 ms 4644 KB Output isn't correct - L* = 0
13 Incorrect 56 ms 4644 KB Output isn't correct - L* = 0
14 Incorrect 65 ms 4644 KB Output isn't correct - L* = 0
15 Incorrect 49 ms 4644 KB Output isn't correct - L* = 0
16 Incorrect 39 ms 4644 KB Output isn't correct - L* = 0
17 Incorrect 59 ms 4644 KB Output isn't correct - L* = 0
18 Incorrect 62 ms 4644 KB Output isn't correct - L* = 0
19 Incorrect 62 ms 4644 KB Output isn't correct - L* = 0
20 Incorrect 49 ms 4644 KB Output isn't correct - L* = 0
21 Incorrect 48 ms 4644 KB Output isn't correct - L* = 0
22 Incorrect 38 ms 4644 KB Output isn't correct - L* = 0
23 Incorrect 55 ms 4644 KB Output isn't correct - L* = 0
24 Incorrect 41 ms 4644 KB Output isn't correct - L* = 0
25 Incorrect 52 ms 4644 KB Output isn't correct - L* = 0
26 Incorrect 56 ms 4644 KB Output isn't correct - L* = 0
27 Incorrect 76 ms 4644 KB Output isn't correct - L* = 0
28 Incorrect 59 ms 4644 KB Output isn't correct - L* = 0
29 Incorrect 35 ms 4644 KB Output isn't correct - L* = 0
30 Incorrect 48 ms 4644 KB Output isn't correct - L* = 0
31 Incorrect 68 ms 4644 KB Output isn't correct - L* = 0
32 Incorrect 72 ms 4644 KB Output isn't correct - L* = 0
33 Incorrect 72 ms 4644 KB Output isn't correct - L* = 0
34 Incorrect 45 ms 4644 KB Output isn't correct - L* = 0
35 Incorrect 46 ms 4644 KB Output isn't correct - L* = 0
36 Incorrect 45 ms 4644 KB Output isn't correct - L* = 0
37 Incorrect 39 ms 4644 KB Output isn't correct - L* = 0
38 Incorrect 62 ms 4644 KB Output isn't correct - L* = 0
39 Incorrect 52 ms 4644 KB Output isn't correct - L* = 0
40 Incorrect 32 ms 4644 KB Output isn't correct - L* = 0