Submission #67025

# Submission time Handle Problem Language Result Execution time Memory
67025 2018-08-13T08:35:57 Z reality Broken Device (JOI17_broken_device) C++17
51 / 100
83 ms 13296 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,1,4};
const int B[] = {0,1,0,1,2,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,1,4};
const int B[] = {0,1,0,1,2,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;
      ^
# Verdict Execution time Memory Grader output
1 Partially correct 55 ms 3056 KB Output is partially correct - L* = 20
2 Partially correct 57 ms 3704 KB Output is partially correct - L* = 21
3 Partially correct 76 ms 3904 KB Output is partially correct - L* = 21
4 Partially correct 53 ms 4472 KB Output is partially correct - L* = 22
5 Partially correct 67 ms 4920 KB Output is partially correct - L* = 20
6 Partially correct 60 ms 4992 KB Output is partially correct - L* = 24
7 Partially correct 57 ms 5224 KB Output is partially correct - L* = 20
8 Partially correct 52 ms 5472 KB Output is partially correct - L* = 21
9 Partially correct 49 ms 5720 KB Output is partially correct - L* = 20
10 Partially correct 79 ms 5984 KB Output is partially correct - L* = 21
11 Partially correct 51 ms 6216 KB Output is partially correct - L* = 22
12 Partially correct 73 ms 6720 KB Output is partially correct - L* = 21
13 Partially correct 66 ms 6720 KB Output is partially correct - L* = 21
14 Partially correct 50 ms 6960 KB Output is partially correct - L* = 22
15 Partially correct 66 ms 7416 KB Output is partially correct - L* = 21
16 Partially correct 83 ms 7440 KB Output is partially correct - L* = 21
17 Partially correct 50 ms 7688 KB Output is partially correct - L* = 21
18 Partially correct 57 ms 7928 KB Output is partially correct - L* = 21
19 Partially correct 68 ms 8168 KB Output is partially correct - L* = 22
20 Partially correct 77 ms 8416 KB Output is partially correct - L* = 21
21 Partially correct 79 ms 8664 KB Output is partially correct - L* = 20
22 Partially correct 64 ms 8904 KB Output is partially correct - L* = 20
23 Partially correct 48 ms 9144 KB Output is partially correct - L* = 20
24 Partially correct 49 ms 9640 KB Output is partially correct - L* = 21
25 Partially correct 48 ms 9640 KB Output is partially correct - L* = 22
26 Partially correct 71 ms 10136 KB Output is partially correct - L* = 22
27 Partially correct 69 ms 10136 KB Output is partially correct - L* = 20
28 Partially correct 55 ms 10632 KB Output is partially correct - L* = 24
29 Partially correct 56 ms 10632 KB Output is partially correct - L* = 22
30 Partially correct 56 ms 10856 KB Output is partially correct - L* = 22
31 Partially correct 55 ms 11104 KB Output is partially correct - L* = 21
32 Partially correct 48 ms 11600 KB Output is partially correct - L* = 23
33 Partially correct 65 ms 11600 KB Output is partially correct - L* = 20
34 Partially correct 78 ms 11832 KB Output is partially correct - L* = 20
35 Partially correct 46 ms 12072 KB Output is partially correct - L* = 20
36 Partially correct 63 ms 12576 KB Output is partially correct - L* = 22
37 Partially correct 67 ms 12824 KB Output is partially correct - L* = 20
38 Partially correct 67 ms 12824 KB Output is partially correct - L* = 22
39 Partially correct 55 ms 13056 KB Output is partially correct - L* = 22
40 Partially correct 57 ms 13296 KB Output is partially correct - L* = 21