답안 #576068

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
576068 2022-06-12T08:55:31 Z zaneyu Broken Device (JOI17_broken_device) C++14
8 / 100
41 ms 2724 KB
#include "Annalib.h"
/*input
3
10 50
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,int>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
namespace {
int v[155];
int ans[155];
void setv(int i,vector<int> v){
    REP(a,3) ans[i*3+a]=v[a]; 
}
int cnt[155];
bool hv[155];
}
void Anna( int N, long long X, int K, int P[] ){
    int cur=0;
    REP(i,60){
        v[i]=(X>>(59-i))&1;
    }
    REP(i,N) cnt[i]=0,hv[i]=0;
    REP(i,K){
        cnt[P[i]/3]++;
        hv[P[i]]=1;
    }
    REP(i,N/3){
        if(!cnt[i]){
            int val=v[cur]*2+v[cur+1];
            if(val==2){
                setv(i,{0,1,1});
            }
            else{
                setv(i,{1,v[cur],v[cur+1]});
            }
            cur+=2;
        }
        else if(cnt[i]==1){
            if(hv[i*3]){
                if(!v[cur]) setv(i,{0,1,0});
                else setv(i,{0,0,1});
                ++cur;
            }
            else if(hv[i*3+2]){
                if(!v[cur]) setv(i,{0,1,0});
                else setv(i,{1,1,0});
                ++cur;
            }
            else{
                if(v[cur]){
                    setv(i,{0,0,1});
                    ++cur;
                }
                else{
                    if(!v[cur+1]) setv(i,{1,0,0});
                    else setv(i,{1,0,1});
                    cur+=2;
                }
            }
        }
    }
    REP(i,N) Set(i,ans[i]);
}
#include "Brunolib.h"
/*input
3
10 50
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,int>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
namespace {
int len[] = { 0, 1, 1, 2, 2, 2, 1, 2 };
int val[] = { 0, 1, 0, 2, 0, 1, 1, 3 };

}
long long Bruno( int N, int A[] ){
    ll ans=0;
    vector<int> cur;
    REP(i,N/3){
        int c=A[i*3]*4+A[i*3+1]*2+A[i*3+2];
        if(len[c]==1) cur.pb(val[c]);
        else cur.pb(val[c]/2),cur.pb(val[c]%2);
    }
    REP(i,60) ans=ans*2+cur[i];
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 40 ms 2460 KB Output is partially correct - L* = 14
2 Partially correct 36 ms 2588 KB Output is partially correct - L* = 14
3 Partially correct 32 ms 2480 KB Output is partially correct - L* = 14
4 Partially correct 31 ms 2580 KB Output is partially correct - L* = 14
5 Partially correct 33 ms 2600 KB Output is partially correct - L* = 14
6 Partially correct 34 ms 2432 KB Output is partially correct - L* = 14
7 Partially correct 31 ms 2540 KB Output is partially correct - L* = 14
8 Partially correct 32 ms 2668 KB Output is partially correct - L* = 14
9 Partially correct 34 ms 2516 KB Output is partially correct - L* = 14
10 Partially correct 30 ms 2424 KB Output is partially correct - L* = 14
11 Partially correct 31 ms 2576 KB Output is partially correct - L* = 14
12 Partially correct 31 ms 2448 KB Output is partially correct - L* = 14
13 Partially correct 32 ms 2488 KB Output is partially correct - L* = 14
14 Partially correct 36 ms 2488 KB Output is partially correct - L* = 14
15 Partially correct 37 ms 2480 KB Output is partially correct - L* = 14
16 Partially correct 32 ms 2524 KB Output is partially correct - L* = 14
17 Partially correct 30 ms 2504 KB Output is partially correct - L* = 14
18 Partially correct 30 ms 2612 KB Output is partially correct - L* = 14
19 Partially correct 30 ms 2540 KB Output is partially correct - L* = 14
20 Partially correct 36 ms 2476 KB Output is partially correct - L* = 14
21 Partially correct 33 ms 2488 KB Output is partially correct - L* = 14
22 Partially correct 37 ms 2588 KB Output is partially correct - L* = 14
23 Partially correct 36 ms 2624 KB Output is partially correct - L* = 14
24 Partially correct 33 ms 2556 KB Output is partially correct - L* = 14
25 Partially correct 31 ms 2512 KB Output is partially correct - L* = 14
26 Partially correct 38 ms 2544 KB Output is partially correct - L* = 14
27 Partially correct 33 ms 2540 KB Output is partially correct - L* = 14
28 Partially correct 31 ms 2480 KB Output is partially correct - L* = 14
29 Partially correct 32 ms 2524 KB Output is partially correct - L* = 14
30 Partially correct 31 ms 2540 KB Output is partially correct - L* = 14
31 Partially correct 36 ms 2428 KB Output is partially correct - L* = 14
32 Partially correct 32 ms 2484 KB Output is partially correct - L* = 14
33 Partially correct 33 ms 2416 KB Output is partially correct - L* = 14
34 Partially correct 39 ms 2480 KB Output is partially correct - L* = 14
35 Partially correct 32 ms 2520 KB Output is partially correct - L* = 14
36 Partially correct 31 ms 2476 KB Output is partially correct - L* = 14
37 Partially correct 35 ms 2724 KB Output is partially correct - L* = 14
38 Partially correct 30 ms 2508 KB Output is partially correct - L* = 14
39 Partially correct 31 ms 2576 KB Output is partially correct - L* = 14
40 Partially correct 41 ms 2604 KB Output is partially correct - L* = 14