답안 #67071

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
67071 2018-08-13T09:48:42 Z reality Broken Device (JOI17_broken_device) C++17
100 / 100
72 ms 4072 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,2,4,4,4,2,4};
const int B[] = {0,0,1,2,3,1,0,0};


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)
  				continue;
  			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,2,4,4,4,2,4};
const int B[] = {0,0,1,2,3,1,0,0};

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:30: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 Correct 46 ms 3312 KB Output is correct - L* = 40
2 Correct 49 ms 3600 KB Output is correct - L* = 40
3 Correct 55 ms 3600 KB Output is correct - L* = 40
4 Correct 52 ms 3712 KB Output is correct - L* = 40
5 Correct 66 ms 3712 KB Output is correct - L* = 40
6 Correct 59 ms 3968 KB Output is correct - L* = 40
7 Correct 61 ms 3968 KB Output is correct - L* = 40
8 Correct 72 ms 3968 KB Output is correct - L* = 40
9 Correct 55 ms 3968 KB Output is correct - L* = 40
10 Correct 57 ms 3968 KB Output is correct - L* = 40
11 Correct 45 ms 3968 KB Output is correct - L* = 40
12 Correct 45 ms 3968 KB Output is correct - L* = 40
13 Correct 66 ms 3968 KB Output is correct - L* = 40
14 Correct 45 ms 3968 KB Output is correct - L* = 40
15 Correct 55 ms 3968 KB Output is correct - L* = 40
16 Correct 57 ms 3968 KB Output is correct - L* = 40
17 Correct 50 ms 3968 KB Output is correct - L* = 40
18 Correct 50 ms 3968 KB Output is correct - L* = 40
19 Correct 47 ms 3968 KB Output is correct - L* = 40
20 Correct 64 ms 3968 KB Output is correct - L* = 40
21 Correct 52 ms 3968 KB Output is correct - L* = 40
22 Correct 62 ms 3968 KB Output is correct - L* = 40
23 Correct 53 ms 3968 KB Output is correct - L* = 40
24 Correct 47 ms 3968 KB Output is correct - L* = 40
25 Correct 51 ms 3968 KB Output is correct - L* = 40
26 Correct 48 ms 3968 KB Output is correct - L* = 40
27 Correct 63 ms 3968 KB Output is correct - L* = 40
28 Correct 48 ms 3968 KB Output is correct - L* = 40
29 Correct 48 ms 3968 KB Output is correct - L* = 40
30 Correct 52 ms 3968 KB Output is correct - L* = 40
31 Correct 48 ms 3968 KB Output is correct - L* = 40
32 Correct 55 ms 3968 KB Output is correct - L* = 40
33 Correct 45 ms 4072 KB Output is correct - L* = 40
34 Correct 54 ms 4072 KB Output is correct - L* = 40
35 Correct 47 ms 4072 KB Output is correct - L* = 40
36 Correct 68 ms 4072 KB Output is correct - L* = 40
37 Correct 49 ms 4072 KB Output is correct - L* = 40
38 Correct 50 ms 4072 KB Output is correct - L* = 40
39 Correct 54 ms 4072 KB Output is correct - L* = 40
40 Correct 46 ms 4072 KB Output is correct - L* = 40