답안 #576070

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
576070 2022-06-12T08:59:13 Z zaneyu Broken Device (JOI17_broken_device) C++14
8 / 100
53 ms 2472 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 if(len[c]==2) 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 36 ms 2328 KB Output is partially correct - L* = 14
2 Partially correct 41 ms 2284 KB Output is partially correct - L* = 14
3 Partially correct 38 ms 2252 KB Output is partially correct - L* = 14
4 Partially correct 35 ms 2340 KB Output is partially correct - L* = 14
5 Partially correct 36 ms 2288 KB Output is partially correct - L* = 14
6 Partially correct 38 ms 2336 KB Output is partially correct - L* = 15
7 Partially correct 36 ms 2472 KB Output is partially correct - L* = 14
8 Partially correct 33 ms 2252 KB Output is partially correct - L* = 14
9 Partially correct 50 ms 2156 KB Output is partially correct - L* = 14
10 Partially correct 33 ms 2264 KB Output is partially correct - L* = 14
11 Partially correct 37 ms 2260 KB Output is partially correct - L* = 14
12 Partially correct 33 ms 2268 KB Output is partially correct - L* = 14
13 Partially correct 38 ms 2224 KB Output is partially correct - L* = 14
14 Partially correct 40 ms 2296 KB Output is partially correct - L* = 14
15 Partially correct 32 ms 2232 KB Output is partially correct - L* = 14
16 Partially correct 33 ms 2252 KB Output is partially correct - L* = 14
17 Partially correct 32 ms 2172 KB Output is partially correct - L* = 14
18 Partially correct 42 ms 2328 KB Output is partially correct - L* = 14
19 Partially correct 32 ms 2320 KB Output is partially correct - L* = 14
20 Partially correct 43 ms 2260 KB Output is partially correct - L* = 14
21 Partially correct 32 ms 2292 KB Output is partially correct - L* = 14
22 Partially correct 31 ms 2320 KB Output is partially correct - L* = 14
23 Partially correct 41 ms 2256 KB Output is partially correct - L* = 14
24 Partially correct 35 ms 2316 KB Output is partially correct - L* = 14
25 Partially correct 33 ms 2228 KB Output is partially correct - L* = 14
26 Partially correct 32 ms 2300 KB Output is partially correct - L* = 14
27 Partially correct 32 ms 2232 KB Output is partially correct - L* = 14
28 Partially correct 38 ms 2152 KB Output is partially correct - L* = 14
29 Partially correct 35 ms 2312 KB Output is partially correct - L* = 14
30 Partially correct 33 ms 2200 KB Output is partially correct - L* = 14
31 Partially correct 32 ms 2248 KB Output is partially correct - L* = 14
32 Partially correct 53 ms 2448 KB Output is partially correct - L* = 14
33 Partially correct 32 ms 2256 KB Output is partially correct - L* = 14
34 Partially correct 36 ms 2344 KB Output is partially correct - L* = 14
35 Partially correct 33 ms 2236 KB Output is partially correct - L* = 14
36 Partially correct 32 ms 2240 KB Output is partially correct - L* = 14
37 Partially correct 33 ms 2384 KB Output is partially correct - L* = 14
38 Partially correct 33 ms 2260 KB Output is partially correct - L* = 14
39 Partially correct 33 ms 2340 KB Output is partially correct - L* = 14
40 Partially correct 32 ms 2240 KB Output is partially correct - L* = 14