답안 #67036

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
67036 2018-08-13T08:52:33 Z reality Broken Device (JOI17_broken_device) C++17
0 / 100
4 ms 1056 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;
  			}
  		int w = 1;
  		if (st[i] + st[i + 1] + st[i + 2] == 1)
  			w = 2;
  		else
  		if (st[i] + st[i + 1] + st[i + 2] == 0)
  			w = 4;
  		assert(A[mask] >= w);
  		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 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 3 ms 700 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 3 ms 712 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 4 ms 860 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 4 ms 860 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 3 ms 860 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 3 ms 860 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 3 ms 860 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 860 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 4 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 4 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 4 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 4 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 4 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 3 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 4 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 3 ms 1056 KB Execution killed with signal 11 (could be triggered by violating memory limits)