Submission #954906

# Submission time Handle Problem Language Result Execution time Memory
954906 2024-03-28T19:21:15 Z Skywk Broken Device (JOI17_broken_device) C++17
0 / 100
2 ms 856 KB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

void Anna(int N, long long X, int K, int P[]){
    vector<int> A(N), B(N);
    for(int i=0; i<K; i++){
        B[P[i]] = 1;
    }
    vector<int> three;
    for(int x = X; x > 0; x /= 3){
        three.push_back(x % 3);
    }
    int sz = three.size();
    for(int i=0, j=0; j < sz; i += 3){
        vector<int> nb;
        for(int k=0; k<3; k++) if(!B[i + k]) nb.push_back(i + k);
        if(three[j] == 0){
            if(nb.size() >= 1){
                A[nb[0]] = 1;
                j++;
            }
        }
        else if(three[j] == 1){
            if(nb.size() >= 2){
                A[nb[0]] = A[nb[1]] = 1;
                j++;
            }
        }
        else{
            if(nb.size() >= 3){
                A[nb[0]] = A[nb[1]] = A[nb[2]] = 1;
                j++;
            }
        }
    }
    for(int i=0; i<N; i++){
        Set(i, A[i]);
    }
}
#include "Brunolib.h"

long long Bruno(int N, int A[]){
    long long X = 0;
    long long thr = 1;
    for(int i=0, j=0; i < N; i += 3){
        int sum = A[i] + A[i + 1] + A[i + 2];
        if(sum == 0) continue;
        X += thr * (sum - 1);
        thr *= 3;
    }
    return X;
}

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:6:18: warning: unused variable 'j' [-Wunused-variable]
    6 |     for(int i=0, j=0; i < N; i += 3){
      |                  ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Runtime error 1 ms 604 KB Execution killed with signal 6
3 Runtime error 1 ms 604 KB Execution killed with signal 6
4 Runtime error 1 ms 604 KB Execution killed with signal 6
5 Runtime error 1 ms 604 KB Execution killed with signal 6
6 Runtime error 1 ms 604 KB Execution killed with signal 6
7 Runtime error 1 ms 604 KB Execution killed with signal 6
8 Runtime error 1 ms 604 KB Execution killed with signal 6
9 Runtime error 1 ms 604 KB Execution killed with signal 6
10 Runtime error 1 ms 604 KB Execution killed with signal 6
11 Runtime error 1 ms 604 KB Execution killed with signal 6
12 Runtime error 1 ms 604 KB Execution killed with signal 6
13 Runtime error 1 ms 604 KB Execution killed with signal 6
14 Runtime error 1 ms 604 KB Execution killed with signal 6
15 Runtime error 1 ms 604 KB Execution killed with signal 6
16 Runtime error 1 ms 604 KB Execution killed with signal 6
17 Runtime error 1 ms 604 KB Execution killed with signal 6
18 Runtime error 1 ms 604 KB Execution killed with signal 6
19 Runtime error 1 ms 604 KB Execution killed with signal 6
20 Runtime error 1 ms 672 KB Execution killed with signal 6
21 Runtime error 1 ms 604 KB Execution killed with signal 6
22 Runtime error 1 ms 604 KB Execution killed with signal 6
23 Runtime error 1 ms 604 KB Execution killed with signal 6
24 Runtime error 1 ms 604 KB Execution killed with signal 6
25 Runtime error 1 ms 604 KB Execution killed with signal 6
26 Runtime error 1 ms 604 KB Execution killed with signal 6
27 Runtime error 1 ms 604 KB Execution killed with signal 6
28 Runtime error 1 ms 604 KB Execution killed with signal 6
29 Runtime error 1 ms 604 KB Execution killed with signal 6
30 Runtime error 1 ms 604 KB Execution killed with signal 6
31 Runtime error 2 ms 604 KB Execution killed with signal 6
32 Runtime error 1 ms 604 KB Execution killed with signal 6
33 Runtime error 1 ms 604 KB Execution killed with signal 6
34 Runtime error 1 ms 856 KB Execution killed with signal 6
35 Runtime error 1 ms 604 KB Execution killed with signal 6
36 Runtime error 1 ms 604 KB Execution killed with signal 6
37 Runtime error 1 ms 604 KB Execution killed with signal 6
38 Runtime error 1 ms 604 KB Execution killed with signal 6
39 Runtime error 1 ms 852 KB Execution killed with signal 6
40 Runtime error 1 ms 604 KB Execution killed with signal 6