답안 #770249

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
770249 2023-07-01T03:31:06 Z minhcool Broken Device (JOI17_broken_device) C++17
67 / 100
37 ms 2708 KB
//#define local
#ifndef local
#include "Annalib.h"
#endif
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

const int N = 3e5 + 5;

const int oo = 1e18 + 7, mod = 1e9 + 7;

mt19937 rng(1);

int rnd(int l, int r){
	int temp = rng() % (r - l + 1);
	return abs(temp) + l;
}

bool out[N];

int arr1[] = {1, 2, 2, 4, 2, 4, 4, 4};
int arr2[] = {0, 0, 0, 0, 1, 1, 2, 3};

int arr3[] = {1, 2, 2, 4, 2, 4, 4, 4};
int arr4[] = {0, 0, 1, 0, 1, 2, 1, 3};

void Anna(int N, long long X, int K, int P[]){
	for(int i = 0; i < N; i++) out[i] = 0;
	for(int i = 0; i < K; i++) out[P[i]] = 1;
	vector<pair<long long, pair<int, int>>> vc;
	//cout << X << "\n";
	for(int i = 0; i < N; i += 3){
	//	if(!X) break;
		if(!(i % 6)){
			int msk = (!out[i]) + (!out[i + 1]) * 2 + (!out[i + 2]) * 4;
			int ind = -1;
			for(int j = 7; j >= 0; j--){
				if((X % arr1[j] == arr2[j]) && ((msk | j) == msk)){
					if(ind == -1) ind = j;
					if(arr1[ind] < arr1[j]) ind = j;
					//break;
				}
			}
			X /= arr1[ind];
		//	cout << i << " " << ind << "\n";
			vc.pb({X, {msk, ind}});
			Set(i, ((ind & 1) != 0));
			Set(i + 1, ((ind & 2) != 0));
			Set(i + 2, ((ind & 4) != 0));
		}
		else{
			int msk = (!out[i]) + (!out[i + 1]) * 2 + (!out[i + 2]) * 4;
			int ind = -1;
			for(int j = 7; j >= 0; j--){
				if((X % arr3[j] == arr4[j]) && ((msk | j) == msk)){
					if(ind == -1) ind = j;
					if(arr3[ind] < arr3[j]) ind = j;
					//break;
				}
			}
			X /= arr3[ind];
		//	cout << i << " " << ind << "\n";
			vc.pb({X, {msk, ind}});
			Set(i, ((ind & 1) != 0));
			Set(i + 1, ((ind & 2) != 0));
			Set(i + 2, ((ind & 4) != 0));
		}
		//cout << X << " " << ind << "\n";
	}
	if(X){
		//for(auto it : vc) cout << it.fi << " " << it.fi % 4 << " " << it.se.fi << " " << it.se.se << "\n";
		//cout << X << "\n";
	}
}

#ifdef local
void process(){

}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t;
	cin >> t;
	while(t--) process();
}
#endif
//#define local
#ifndef local
#include "Brunolib.h"
#endif
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

const int N = 3e5 + 5;

const int oo = 1e18 + 7, mod = 1e9 + 7;

//mt19937 rng(1);

int arr11[] = {1, 2, 2, 4, 2, 4, 4, 4};
int arr22[] = {0, 0, 0, 0, 1, 1, 2, 3};

int arr33[] = {1, 2, 2, 4, 2, 4, 4, 4};
int arr44[] = {0, 0, 1, 0, 1, 2, 1, 3};

long long Bruno(int N, int A[]){
	long long ans = 0;
	for(int i = N - 3; i >= 0; i -= 3){
		if(!(i % 6)){
			int temp = A[i] + 2 * A[i + 1] + 4 * A[i + 2];
		//	cout << temp << "\n";
			ans = (ans * arr11[temp]) + arr22[temp];	
		}
		else{
			int temp = A[i] + 2 * A[i + 1] + 4 * A[i + 2];
		//	cout << temp << "\n";
			ans = (ans * arr33[temp]) + arr44[temp];
		}
	}
	//cout << ans << "\n";
	return ans;
}

#ifdef local
void process(){

}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t;
	cin >> t;
	while(t--) process();
}
#endif

Compilation message

Anna.cpp:22:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   22 | const int oo = 1e18 + 7, mod = 1e9 + 7;
      |                ~~~~~^~~

Bruno.cpp:22:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   22 | const int oo = 1e18 + 7, mod = 1e9 + 7;
      |                ~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 27 ms 2632 KB Output is partially correct - L* = 30
2 Partially correct 30 ms 2628 KB Output is partially correct - L* = 33
3 Partially correct 34 ms 2548 KB Output is partially correct - L* = 37
4 Partially correct 34 ms 2528 KB Output is partially correct - L* = 30
5 Partially correct 27 ms 2636 KB Output is partially correct - L* = 34
6 Partially correct 27 ms 2524 KB Output is partially correct - L* = 33
7 Partially correct 33 ms 2608 KB Output is partially correct - L* = 34
8 Partially correct 30 ms 2512 KB Output is partially correct - L* = 37
9 Partially correct 34 ms 2488 KB Output is partially correct - L* = 33
10 Partially correct 34 ms 2484 KB Output is partially correct - L* = 36
11 Partially correct 27 ms 2572 KB Output is partially correct - L* = 33
12 Partially correct 27 ms 2556 KB Output is partially correct - L* = 34
13 Partially correct 27 ms 2680 KB Output is partially correct - L* = 34
14 Partially correct 27 ms 2468 KB Output is partially correct - L* = 31
15 Partially correct 36 ms 2540 KB Output is partially correct - L* = 32
16 Partially correct 28 ms 2628 KB Output is partially correct - L* = 28
17 Partially correct 30 ms 2632 KB Output is partially correct - L* = 37
18 Partially correct 27 ms 2668 KB Output is partially correct - L* = 33
19 Partially correct 27 ms 2504 KB Output is partially correct - L* = 33
20 Partially correct 32 ms 2568 KB Output is partially correct - L* = 29
21 Partially correct 27 ms 2580 KB Output is partially correct - L* = 30
22 Partially correct 30 ms 2536 KB Output is partially correct - L* = 37
23 Partially correct 28 ms 2596 KB Output is partially correct - L* = 37
24 Partially correct 30 ms 2636 KB Output is partially correct - L* = 32
25 Partially correct 28 ms 2472 KB Output is partially correct - L* = 37
26 Partially correct 28 ms 2660 KB Output is partially correct - L* = 32
27 Partially correct 32 ms 2708 KB Output is partially correct - L* = 31
28 Partially correct 27 ms 2468 KB Output is partially correct - L* = 37
29 Partially correct 28 ms 2540 KB Output is partially correct - L* = 33
30 Partially correct 33 ms 2556 KB Output is partially correct - L* = 30
31 Partially correct 32 ms 2500 KB Output is partially correct - L* = 31
32 Partially correct 27 ms 2556 KB Output is partially correct - L* = 33
33 Partially correct 27 ms 2428 KB Output is partially correct - L* = 30
34 Partially correct 33 ms 2504 KB Output is partially correct - L* = 37
35 Partially correct 27 ms 2652 KB Output is partially correct - L* = 33
36 Partially correct 37 ms 2636 KB Output is partially correct - L* = 33
37 Partially correct 27 ms 2540 KB Output is partially correct - L* = 31
38 Partially correct 28 ms 2560 KB Output is partially correct - L* = 37
39 Partially correct 30 ms 2604 KB Output is partially correct - L* = 35
40 Partially correct 28 ms 2484 KB Output is partially correct - L* = 34