Submission #991262

# Submission time Handle Problem Language Result Execution time Memory
991262 2024-06-01T16:37:31 Z onbert Broken Device (JOI17_broken_device) C++17
85 / 100
30 ms 3096 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int m = 37;

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]==0) a[i] = 0;
    int cur = 0;
    for (int i=0;i<n;i+=2) if (a[i]) {
        int val = x%3;
        if (val==0) a[i] = 0, a[i+1] = 1;
        if (val==1) a[i] = 1, a[i+1] = 0;
        x /= 3;
    }
    // for (int i=0;i<n;i++) cout << a[i]; cout << endl;
    for (int i=0;i<n;i++) Set(i, (int32_t)a[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int m = 37;

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++;
    }
    // cout << x << endl;
    return x;
}

Compilation message

Anna.cpp: In function 'void Anna(int32_t, long long int, int32_t, int32_t*)':
Anna.cpp:15:9: warning: unused variable 'cur' [-Wunused-variable]
   15 |     int cur = 0;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Partially correct 24 ms 2736 KB Output is partially correct - L* = 37
2 Partially correct 20 ms 2760 KB Output is partially correct - L* = 37
3 Partially correct 20 ms 2756 KB Output is partially correct - L* = 37
4 Partially correct 20 ms 2752 KB Output is partially correct - L* = 37
5 Partially correct 20 ms 2856 KB Output is partially correct - L* = 37
6 Partially correct 20 ms 2756 KB Output is partially correct - L* = 37
7 Partially correct 20 ms 2760 KB Output is partially correct - L* = 37
8 Partially correct 22 ms 2760 KB Output is partially correct - L* = 37
9 Partially correct 20 ms 2760 KB Output is partially correct - L* = 37
10 Partially correct 27 ms 3008 KB Output is partially correct - L* = 37
11 Partially correct 20 ms 2652 KB Output is partially correct - L* = 37
12 Partially correct 20 ms 2844 KB Output is partially correct - L* = 37
13 Partially correct 20 ms 2760 KB Output is partially correct - L* = 37
14 Partially correct 20 ms 2756 KB Output is partially correct - L* = 37
15 Partially correct 20 ms 2756 KB Output is partially correct - L* = 37
16 Partially correct 20 ms 2756 KB Output is partially correct - L* = 37
17 Partially correct 20 ms 3088 KB Output is partially correct - L* = 37
18 Partially correct 26 ms 3096 KB Output is partially correct - L* = 37
19 Partially correct 24 ms 2944 KB Output is partially correct - L* = 37
20 Partially correct 23 ms 2760 KB Output is partially correct - L* = 37
21 Partially correct 20 ms 2840 KB Output is partially correct - L* = 37
22 Partially correct 20 ms 2696 KB Output is partially correct - L* = 37
23 Partially correct 20 ms 2756 KB Output is partially correct - L* = 37
24 Partially correct 20 ms 2768 KB Output is partially correct - L* = 37
25 Partially correct 20 ms 2760 KB Output is partially correct - L* = 37
26 Partially correct 20 ms 2768 KB Output is partially correct - L* = 37
27 Partially correct 20 ms 2840 KB Output is partially correct - L* = 37
28 Partially correct 20 ms 2756 KB Output is partially correct - L* = 37
29 Partially correct 24 ms 2732 KB Output is partially correct - L* = 37
30 Partially correct 24 ms 2856 KB Output is partially correct - L* = 37
31 Partially correct 20 ms 2756 KB Output is partially correct - L* = 37
32 Partially correct 24 ms 2736 KB Output is partially correct - L* = 37
33 Partially correct 26 ms 2752 KB Output is partially correct - L* = 37
34 Partially correct 20 ms 2752 KB Output is partially correct - L* = 37
35 Partially correct 22 ms 2752 KB Output is partially correct - L* = 37
36 Partially correct 24 ms 2760 KB Output is partially correct - L* = 37
37 Partially correct 23 ms 2756 KB Output is partially correct - L* = 37
38 Partially correct 20 ms 2900 KB Output is partially correct - L* = 37
39 Partially correct 26 ms 2756 KB Output is partially correct - L* = 37
40 Partially correct 30 ms 2672 KB Output is partially correct - L* = 37