Submission #26817

# Submission time Handle Problem Language Result Execution time Memory
26817 2017-07-06T07:11:54 Z wangyenjen Broken Device (JOI17_broken_device) C++14
8 / 100
205 ms 4640 KB
/// Author: Wang, Yen-Jen
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

static bool st[150];
static bool val[150];
static bool vis[150];
static bitset<151> A[60];

void Anna(int N , long long X , int K , int P[]) {
    memset(st , 0 , sizeof(st));
    for(int i = 0; i < K; i++) st[P[i]] = 1;
    for(int i = 0; i < 60; i++) {
        A[i].reset();
        for(int j = 0; j < N; j++) {
            if((j + 1) % (i + 1) == 0) {
                if(st[j]) A[i][j] = 0;
                else A[i][j] = 1;
            }
            else A[i][j] = 0;
        }
        A[i][N] = ((X>>i)&1);
    }
    memset(val , 0 , sizeof(val));
    memset(vis , 0 , sizeof(vis));
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        int p = -1;
        for(int j = cnt; j < 60; j++) {
            if(A[j][i]) {
                p = j;
                break;
            }
        }
        if(p == -1) continue;
        if(p != cnt) swap(A[p] , A[cnt]);
        for(int j = cnt + 1; j < 60; j++) {
            if(A[j][i]) A[j] ^= A[cnt];
        }
        vis[i] = 1;
        if(++cnt == 60) break;
    }
    for(int i = 0; i < N; i++) {
        if(!st[i]) {
            if(!vis[i]) {
                vis[i] = 1;
                val[i] = 0;
            }
            else vis[i] = 0;
        }
        else vis[i] = 1;
    }
    for(int i = 59; i >= 0; i--) {
        int p = -1;
        for(int j = 0; j < N; j++) {
            if(A[i][j]) {
                if(vis[j]) {
                    A[i][N] = (A[i][N] ^ val[j]);
                    A[i][j] = 0;
                }
                else p = j;
            }
        }
        if(p != -1) {
            vis[p] = 1;
            val[p] = A[i][N];
        }
    }
    for(int i = 0; i < N; i++) assert(vis[i]);
    for(int i = 0; i < N; i++) Set(i , val[i]);
}
/// Author: Wang, Yen-Jen
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

long long Bruno(int N , int A[]) {
    long long X = 0;
    for(int i = 0; i < 60; i++) {
        for(int j = 0; j < N; j++) {
            if((j + 1) % (i + 1) == 0) X ^= ((long long)A[j]<<i);
        }
    }
    return X;
}
# Verdict Execution time Memory Grader output
1 Partially correct 179 ms 4640 KB Output is partially correct - L* = 16
2 Partially correct 155 ms 4640 KB Output is partially correct - L* = 15
3 Partially correct 172 ms 4640 KB Output is partially correct - L* = 14
4 Partially correct 162 ms 4640 KB Output is partially correct - L* = 22
5 Partially correct 178 ms 4640 KB Output is partially correct - L* = 16
6 Partially correct 182 ms 4640 KB Output is partially correct - L* = 14
7 Partially correct 172 ms 4640 KB Output is partially correct - L* = 15
8 Partially correct 169 ms 4640 KB Output is partially correct - L* = 14
9 Partially correct 176 ms 4640 KB Output is partially correct - L* = 15
10 Partially correct 164 ms 4640 KB Output is partially correct - L* = 20
11 Partially correct 175 ms 4640 KB Output is partially correct - L* = 14
12 Partially correct 167 ms 4640 KB Output is partially correct - L* = 15
13 Partially correct 185 ms 4640 KB Output is partially correct - L* = 16
14 Partially correct 205 ms 4640 KB Output is partially correct - L* = 15
15 Partially correct 179 ms 4640 KB Output is partially correct - L* = 16
16 Partially correct 176 ms 4640 KB Output is partially correct - L* = 15
17 Partially correct 172 ms 4640 KB Output is partially correct - L* = 18
18 Partially correct 182 ms 4640 KB Output is partially correct - L* = 14
19 Partially correct 185 ms 4640 KB Output is partially correct - L* = 17
20 Partially correct 179 ms 4640 KB Output is partially correct - L* = 16
21 Partially correct 179 ms 4640 KB Output is partially correct - L* = 14
22 Partially correct 169 ms 4640 KB Output is partially correct - L* = 16
23 Partially correct 195 ms 4640 KB Output is partially correct - L* = 15
24 Partially correct 168 ms 4640 KB Output is partially correct - L* = 14
25 Partially correct 182 ms 4640 KB Output is partially correct - L* = 15
26 Partially correct 172 ms 4640 KB Output is partially correct - L* = 16
27 Partially correct 175 ms 4640 KB Output is partially correct - L* = 17
28 Partially correct 165 ms 4640 KB Output is partially correct - L* = 16
29 Partially correct 169 ms 4640 KB Output is partially correct - L* = 18
30 Partially correct 162 ms 4640 KB Output is partially correct - L* = 15
31 Partially correct 175 ms 4640 KB Output is partially correct - L* = 18
32 Partially correct 167 ms 4640 KB Output is partially correct - L* = 18
33 Partially correct 175 ms 4640 KB Output is partially correct - L* = 15
34 Partially correct 164 ms 4640 KB Output is partially correct - L* = 16
35 Partially correct 149 ms 4640 KB Output is partially correct - L* = 15
36 Partially correct 165 ms 4640 KB Output is partially correct - L* = 14
37 Partially correct 169 ms 4640 KB Output is partially correct - L* = 16
38 Partially correct 175 ms 4640 KB Output is partially correct - L* = 18
39 Partially correct 182 ms 4640 KB Output is partially correct - L* = 17
40 Partially correct 172 ms 4640 KB Output is partially correct - L* = 18