Submission #378356

# Submission time Handle Problem Language Result Execution time Memory
378356 2021-03-16T14:31:09 Z EIMONIM Broken Device (JOI17_broken_device) C++14
85 / 100
66 ms 2880 KB
#include <bits/stdc++.h>
#define ll long long
#include "Annalib.h"
using namespace std;
pair<int,int>val(int x)
{
    if (x==0)
        return {0,1};
    if (x==1)
        return {1,0};
    return {1,1};
}
void Anna(int n,ll x,int k,int p[])
{
    srand(139);
    vector<int>aux(n);
    int i;
    for(i=0;i<n;i++)
        aux[i]=i;
    random_shuffle(aux.begin(),aux.end());
    vector<bool>poz(n,0),ans(n);
    for(i=0;i<k;i++)
        poz[p[i]]=1;
    for(i=0;i<n;i+=2){
        auto num=val(x%3);
        if ((poz[aux[i]]==0 || 0) && (poz[aux[i+1]]==0 || 0)){
            ans[aux[i]]=num.first;
            ans[aux[i+1]]=num.second;
            x=x/3;
        }
    }
    for(i=0;i<n;i++)
        Set(i,ans[i]);
}
#include<bits/stdc++.h>
#define ll long long
#include "Brunolib.h"
using namespace std;
int val(pair<int,int>num)
{
    if (num.first+num.second==2)
        return 2;
    return num.first;
}
ll Bruno(int n,int a[])
{
    srand(139);
    vector<int>aux(n);
    int i;
    for(i=0;i<n;i++)
        aux[i]=i;
    random_shuffle(aux.begin(),aux.end());
    ll ans=0,po=1;
    for(i=0;i<n;i+=2){
        if (a[aux[i]] || a[aux[i+1]]){
            ans=ans+po*val({a[aux[i]],a[aux[i+1]]});
            po=po*3;
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 50 ms 2692 KB Output is partially correct - L* = 38
2 Partially correct 53 ms 2836 KB Output is partially correct - L* = 39
3 Partially correct 50 ms 2692 KB Output is partially correct - L* = 38
4 Partially correct 55 ms 2768 KB Output is partially correct - L* = 38
5 Partially correct 58 ms 2692 KB Output is partially correct - L* = 39
6 Partially correct 55 ms 2496 KB Output is partially correct - L* = 39
7 Partially correct 51 ms 2492 KB Output is partially correct - L* = 38
8 Partially correct 52 ms 2528 KB Output is partially correct - L* = 38
9 Partially correct 53 ms 2692 KB Output is partially correct - L* = 38
10 Partially correct 57 ms 2560 KB Output is partially correct - L* = 38
11 Partially correct 50 ms 2700 KB Output is partially correct - L* = 38
12 Partially correct 50 ms 2492 KB Output is partially correct - L* = 38
13 Partially correct 52 ms 2732 KB Output is partially correct - L* = 38
14 Partially correct 66 ms 2692 KB Output is partially correct - L* = 38
15 Partially correct 51 ms 2820 KB Output is partially correct - L* = 39
16 Partially correct 51 ms 2620 KB Output is partially correct - L* = 38
17 Partially correct 53 ms 2620 KB Output is partially correct - L* = 39
18 Partially correct 51 ms 2620 KB Output is partially correct - L* = 39
19 Partially correct 55 ms 2492 KB Output is partially correct - L* = 39
20 Partially correct 51 ms 2692 KB Output is partially correct - L* = 38
21 Partially correct 50 ms 2492 KB Output is partially correct - L* = 38
22 Partially correct 52 ms 2492 KB Output is partially correct - L* = 38
23 Partially correct 52 ms 2620 KB Output is partially correct - L* = 37
24 Partially correct 51 ms 2760 KB Output is partially correct - L* = 39
25 Partially correct 55 ms 2880 KB Output is partially correct - L* = 38
26 Partially correct 52 ms 2700 KB Output is partially correct - L* = 38
27 Partially correct 53 ms 2620 KB Output is partially correct - L* = 38
28 Partially correct 52 ms 2492 KB Output is partially correct - L* = 38
29 Partially correct 51 ms 2492 KB Output is partially correct - L* = 39
30 Partially correct 52 ms 2692 KB Output is partially correct - L* = 39
31 Partially correct 50 ms 2492 KB Output is partially correct - L* = 38
32 Partially correct 50 ms 2492 KB Output is partially correct - L* = 39
33 Partially correct 51 ms 2640 KB Output is partially correct - L* = 39
34 Partially correct 52 ms 2492 KB Output is partially correct - L* = 38
35 Partially correct 50 ms 2620 KB Output is partially correct - L* = 39
36 Partially correct 52 ms 2752 KB Output is partially correct - L* = 39
37 Partially correct 52 ms 2492 KB Output is partially correct - L* = 38
38 Partially correct 52 ms 2492 KB Output is partially correct - L* = 39
39 Partially correct 53 ms 2492 KB Output is partially correct - L* = 38
40 Partially correct 52 ms 2640 KB Output is partially correct - L* = 39