답안 #67035

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
67035 2018-08-13T08:51:56 Z reality Broken Device (JOI17_broken_device) C++17
51 / 100
66 ms 3928 KB
#include "Annalib.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}

const int NN = 256;

int st[NN];

const int A[] = {1,2,4,4,4,4,2,4};
const int B[] = {0,1,0,2,1,0,1,3};


void Anna(int N,ll X,int K,int P[]) {
  	int n = N;
  	for (int i = 0;i < N;++i)
  		st[i] = 0;
  	for (int i = 0;i < K;++i)
  		st[P[i]] = 1;
  	for (int i = 0;i < N;i += 3) {
  		int bl = st[i] + st[i + 1] * 2 + st[i + 2] * 4;
  		int mask = 0;
  		for (int j = 1;j < 8;++j)
  			if (!(j & bl) && (X & (A[j] - 1)) == B[j]) {
  				if (A[mask] < A[j])
  					mask = j;
  			}
  		for (int j = 0;j < 3;++j)
  			Set(i + j,(mask >> j) & 1);
  		X /= A[mask];
  	}
}
#include "Brunolib.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}

const int A[] = {1,2,4,4,4,4,2,4};
const int B[] = {0,1,0,2,1,0,1,3};

long long Bruno( int N, int S[] ){
	int n = N;
	ll ans = 0;
	ll was = 1;
	for (int i = 0;i < N;i += 3) {
		int cnt = S[i] + S[i + 1] * 2 + S[i + 2] * 4;
		ans += was * B[cnt];
		was *= A[cnt];
	}
	return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:29:8: warning: unused variable 'n' [-Wunused-variable]
    int n = N;
        ^

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:25:6: warning: unused variable 'n' [-Wunused-variable]
  int n = N;
      ^
# 결과 실행 시간 메모리 Grader output
1 Partially correct 59 ms 3056 KB Output is partially correct - L* = 23
2 Partially correct 51 ms 3248 KB Output is partially correct - L* = 21
3 Partially correct 63 ms 3248 KB Output is partially correct - L* = 24
4 Partially correct 66 ms 3264 KB Output is partially correct - L* = 21
5 Partially correct 63 ms 3424 KB Output is partially correct - L* = 21
6 Partially correct 51 ms 3448 KB Output is partially correct - L* = 22
7 Partially correct 51 ms 3544 KB Output is partially correct - L* = 23
8 Partially correct 53 ms 3544 KB Output is partially correct - L* = 20
9 Partially correct 49 ms 3568 KB Output is partially correct - L* = 22
10 Partially correct 54 ms 3600 KB Output is partially correct - L* = 23
11 Partially correct 51 ms 3600 KB Output is partially correct - L* = 20
12 Partially correct 50 ms 3600 KB Output is partially correct - L* = 21
13 Partially correct 59 ms 3600 KB Output is partially correct - L* = 22
14 Partially correct 60 ms 3632 KB Output is partially correct - L* = 22
15 Partially correct 53 ms 3840 KB Output is partially correct - L* = 20
16 Partially correct 59 ms 3840 KB Output is partially correct - L* = 21
17 Partially correct 53 ms 3840 KB Output is partially correct - L* = 20
18 Partially correct 56 ms 3840 KB Output is partially correct - L* = 24
19 Partially correct 56 ms 3840 KB Output is partially correct - L* = 22
20 Partially correct 54 ms 3840 KB Output is partially correct - L* = 22
21 Partially correct 51 ms 3840 KB Output is partially correct - L* = 20
22 Partially correct 51 ms 3840 KB Output is partially correct - L* = 21
23 Partially correct 50 ms 3840 KB Output is partially correct - L* = 23
24 Partially correct 47 ms 3928 KB Output is partially correct - L* = 23
25 Partially correct 64 ms 3928 KB Output is partially correct - L* = 22
26 Partially correct 56 ms 3928 KB Output is partially correct - L* = 23
27 Partially correct 51 ms 3928 KB Output is partially correct - L* = 23
28 Partially correct 47 ms 3928 KB Output is partially correct - L* = 23
29 Partially correct 52 ms 3928 KB Output is partially correct - L* = 26
30 Partially correct 47 ms 3928 KB Output is partially correct - L* = 21
31 Partially correct 60 ms 3928 KB Output is partially correct - L* = 21
32 Partially correct 53 ms 3928 KB Output is partially correct - L* = 21
33 Partially correct 44 ms 3928 KB Output is partially correct - L* = 22
34 Partially correct 50 ms 3928 KB Output is partially correct - L* = 22
35 Partially correct 47 ms 3928 KB Output is partially correct - L* = 20
36 Partially correct 46 ms 3928 KB Output is partially correct - L* = 23
37 Partially correct 53 ms 3928 KB Output is partially correct - L* = 23
38 Partially correct 47 ms 3928 KB Output is partially correct - L* = 25
39 Partially correct 58 ms 3928 KB Output is partially correct - L* = 22
40 Partially correct 45 ms 3928 KB Output is partially correct - L* = 23