답안 #363365

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
363365 2021-02-05T17:53:42 Z denkendoemeer Broken Device (JOI17_broken_device) C++14
100 / 100
63 ms 2892 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(1);
    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 || num.first==0) && (poz[aux[i+1]]==0 || num.second==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(1);
    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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 2700 KB Output is correct - L* = 40
2 Correct 53 ms 2748 KB Output is correct - L* = 40
3 Correct 50 ms 2820 KB Output is correct - L* = 40
4 Correct 52 ms 2716 KB Output is correct - L* = 40
5 Correct 51 ms 2620 KB Output is correct - L* = 40
6 Correct 50 ms 2492 KB Output is correct - L* = 40
7 Correct 50 ms 2492 KB Output is correct - L* = 40
8 Correct 52 ms 2868 KB Output is correct - L* = 40
9 Correct 52 ms 2620 KB Output is correct - L* = 40
10 Correct 54 ms 2892 KB Output is correct - L* = 40
11 Correct 52 ms 2700 KB Output is correct - L* = 40
12 Correct 52 ms 2492 KB Output is correct - L* = 40
13 Correct 51 ms 2692 KB Output is correct - L* = 40
14 Correct 51 ms 2700 KB Output is correct - L* = 40
15 Correct 51 ms 2492 KB Output is correct - L* = 40
16 Correct 52 ms 2692 KB Output is correct - L* = 40
17 Correct 56 ms 2620 KB Output is correct - L* = 40
18 Correct 51 ms 2692 KB Output is correct - L* = 40
19 Correct 51 ms 2620 KB Output is correct - L* = 40
20 Correct 53 ms 2700 KB Output is correct - L* = 40
21 Correct 51 ms 2692 KB Output is correct - L* = 40
22 Correct 51 ms 2620 KB Output is correct - L* = 40
23 Correct 55 ms 2696 KB Output is correct - L* = 40
24 Correct 51 ms 2692 KB Output is correct - L* = 40
25 Correct 52 ms 2608 KB Output is correct - L* = 40
26 Correct 51 ms 2620 KB Output is correct - L* = 40
27 Correct 50 ms 2692 KB Output is correct - L* = 40
28 Correct 50 ms 2492 KB Output is correct - L* = 40
29 Correct 63 ms 2620 KB Output is correct - L* = 40
30 Correct 50 ms 2492 KB Output is correct - L* = 40
31 Correct 51 ms 2620 KB Output is correct - L* = 40
32 Correct 56 ms 2804 KB Output is correct - L* = 40
33 Correct 52 ms 2692 KB Output is correct - L* = 40
34 Correct 51 ms 2692 KB Output is correct - L* = 40
35 Correct 52 ms 2620 KB Output is correct - L* = 40
36 Correct 50 ms 2736 KB Output is correct - L* = 40
37 Correct 52 ms 2692 KB Output is correct - L* = 40
38 Correct 50 ms 2492 KB Output is correct - L* = 40
39 Correct 51 ms 2648 KB Output is correct - L* = 40
40 Correct 50 ms 2640 KB Output is correct - L* = 40