Submission #991254

# Submission time Handle Problem Language Result Execution time Memory
991254 2024-06-01T16:21:54 Z onbert Broken Device (JOI17_broken_device) C++14
0 / 100
1 ms 604 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int m = 38;

void Anna(int32_t n, long long x, int32_t k, int32_t p[]){
    int pwr[m+1];
    pwr[0] = 1;
    for (int i=1;i<=m;i++) pwr[i] = pwr[i-1] * 3;
    int a[n];
    for (int i=0;i<n;i++) a[i] = 1;
    for (int i=0;i<k;i++) a[p[i]] = 0;
    for (int i=0;i<n;i++) if (!a[i ^ 1]) a[i] = 0;
    int cur = 0;
    for (int i=0;i<n;i+=2) if (a[i]) {
        int val = (x/pwr[cur])%3;
        if (val==0) a[i] = 0, a[i+1] = 1;
        if (val==1) a[i] = 1, a[i+1] = 0;
        cur++;
    }
    for (int i=0;i<n;i++) Set(i, a[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int m = 38;

long long Bruno(int32_t n, int32_t a[]){
    int pwr[m+1];
    pwr[0] = 1;
    for (int i=1;i<=m;i++) pwr[i] = pwr[i-1] * 3;
    int x = 0;
    int cur = 0;
    for (int i=0;i<n && cur<=m;i+=2) if (a[i]==1 || a[i+1]==1) {
        if (a[i]==1 && a[i+1]==0) x += pwr[cur];
        if (a[i]==1 && a[i+1]==1) x += 2*pwr[cur];
        cur++;
    }
    return x;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 8
2 Runtime error 0 ms 348 KB Execution killed with signal 8
3 Runtime error 1 ms 344 KB Execution killed with signal 8
4 Runtime error 1 ms 344 KB Execution killed with signal 8
5 Runtime error 1 ms 348 KB Execution killed with signal 8
6 Runtime error 1 ms 348 KB Execution killed with signal 8
7 Runtime error 1 ms 344 KB Execution killed with signal 8
8 Runtime error 1 ms 604 KB Execution killed with signal 8
9 Runtime error 1 ms 348 KB Execution killed with signal 8
10 Runtime error 0 ms 348 KB Execution killed with signal 8
11 Runtime error 1 ms 348 KB Execution killed with signal 8
12 Runtime error 0 ms 348 KB Execution killed with signal 8
13 Runtime error 1 ms 348 KB Execution killed with signal 8
14 Runtime error 1 ms 348 KB Execution killed with signal 8
15 Runtime error 1 ms 348 KB Execution killed with signal 8
16 Runtime error 1 ms 348 KB Execution killed with signal 8
17 Runtime error 1 ms 360 KB Execution killed with signal 8
18 Runtime error 1 ms 344 KB Execution killed with signal 8
19 Runtime error 1 ms 348 KB Execution killed with signal 8
20 Runtime error 1 ms 348 KB Execution killed with signal 8
21 Runtime error 0 ms 348 KB Execution killed with signal 8
22 Runtime error 1 ms 348 KB Execution killed with signal 8
23 Runtime error 1 ms 348 KB Execution killed with signal 8
24 Runtime error 0 ms 428 KB Execution killed with signal 8
25 Runtime error 1 ms 604 KB Execution killed with signal 8
26 Runtime error 0 ms 344 KB Execution killed with signal 8
27 Runtime error 1 ms 348 KB Execution killed with signal 8
28 Runtime error 1 ms 348 KB Execution killed with signal 8
29 Runtime error 1 ms 348 KB Execution killed with signal 8
30 Runtime error 1 ms 344 KB Execution killed with signal 8
31 Runtime error 1 ms 604 KB Execution killed with signal 8
32 Runtime error 1 ms 604 KB Execution killed with signal 8
33 Runtime error 1 ms 348 KB Execution killed with signal 8
34 Runtime error 1 ms 348 KB Execution killed with signal 8
35 Runtime error 0 ms 348 KB Execution killed with signal 8
36 Runtime error 1 ms 604 KB Execution killed with signal 8
37 Runtime error 0 ms 348 KB Execution killed with signal 8
38 Runtime error 0 ms 344 KB Execution killed with signal 8
39 Runtime error 1 ms 348 KB Execution killed with signal 8
40 Runtime error 1 ms 604 KB Execution killed with signal 8