답안 #913662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
913662 2024-01-20T08:40:27 Z blackscreen1 Coreputer (IOI23_coreputer) C++17
80 / 100
1 ms 596 KB
#include "coreputer.h"
#include <bits//stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_multiset;
#define ll long long
#define ld long double
#define iloop(m, h) for (ll i = m; i != h; i += (m < h ? 1 : -1))
#define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1))
#define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1))
#define lloop(m, h) for (auto l = m; l != h; l += (m < h ? 1 : -1))
#define iloop_(m, h, g) for (auto i = m; i != h; i += g)
#define jloop_(m, h, g) for (auto j = m; j != h; j += g)
#define kloop_(m, h, g) for (auto k = m; k != h; k += g)
#define lloop_(m, h, g) for (auto l = m; l != h; l += g)
#define getchar_unlocked _getchar_nolock // comment before submission
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define pllll pair<pll, pll>
#define vll vector<ll>
#define qll queue<ll>
#define dll deque<ll>
#define pqll priority_queue<ll>
#define gll greater<ll>
#define INF 1000000000000000
#define MOD1 1000000007
#define MOD2 998244353
#define MOD3 1000000009
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
vector<int> malfunctioning_cores(int N) {
	int lb = 0, ub = N-1, mid;
	bool is_even = 0;
	while (ub > lb) {
		mid = (lb + ub)>>1;
		vector<int> v;
		iloop(0, mid+1) v.push_back(i);
		int tm = run_diagnostic(v);
		if (tm == -1) lb = mid + 1;
		else {
			ub = mid;
			if (tm == 0) is_even = 1;
		}
	}
	bool is[N];
	memset(is, 0, sizeof(is));
	is[lb] = 1;
	if (is_even) {
		int cnt = -1;
		vector<int> v;
		iloop(0, lb+1) v.push_back(i);
		iloop(lb+1, N) {
			v.push_back(i);
			if (run_diagnostic(v) != 0) {is[i] = 1; cnt++;}
			v.pop_back();
		}
		v.clear();
		iloop(lb+1, N) v.push_back(i);
		iloop(max(lb-1, 0), 0) {
			v.push_back(i);
			if (run_diagnostic(v) != 0) {is[i] = 1; cnt--;}
			v.pop_back();
		}
		if (cnt) is[0] = 1;
	}
	else {
		int cnt = 0;
		vector<int> v;
		iloop(0, lb) v.push_back(i);
		iloop(lb+1, N) {
			v.push_back(i);
			if (run_diagnostic(v) != -1) {is[i] = 1; cnt++;}
			v.pop_back();
		}
		v.clear();
		iloop(lb+1, N) v.push_back(i);
		iloop(max(lb-1, 0), 0) {
			v.push_back(i);
			if (run_diagnostic(v) != -1) {is[i] = 1; cnt--;}
			v.pop_back();
		}
		if (lb != 0 && cnt) is[0] = 1;
	}
	vector<int> ans;
	iloop(0, N) ans.push_back(is[i]);
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 416 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 512 KB Output is correct
15 Correct 0 ms 500 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 500 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 500 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 500 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 596 KB Output is correct
26 Correct 0 ms 432 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 516 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Partially correct 1 ms 516 KB Output is partially correct
36 Correct 1 ms 504 KB Output is correct
37 Correct 1 ms 344 KB Output is correct
38 Correct 1 ms 508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 416 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 364 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 0 ms 500 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 500 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 500 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 500 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 596 KB Output is correct
29 Correct 0 ms 432 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 1 ms 516 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 1 ms 344 KB Output is correct
38 Partially correct 1 ms 516 KB Output is partially correct
39 Correct 1 ms 504 KB Output is correct
40 Correct 1 ms 344 KB Output is correct
41 Correct 1 ms 508 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 1 ms 504 KB Output is correct
44 Correct 1 ms 344 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 504 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 1 ms 344 KB Output is correct
52 Correct 1 ms 596 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 1 ms 344 KB Output is correct
56 Correct 0 ms 344 KB Output is correct
57 Correct 1 ms 404 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 1 ms 344 KB Output is correct
60 Correct 1 ms 596 KB Output is correct
61 Correct 1 ms 344 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 344 KB Output is correct
66 Correct 1 ms 500 KB Output is correct
67 Correct 1 ms 344 KB Output is correct
68 Correct 1 ms 508 KB Output is correct
69 Correct 1 ms 344 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 0 ms 344 KB Output is correct
72 Correct 1 ms 344 KB Output is correct
73 Correct 1 ms 344 KB Output is correct
74 Correct 1 ms 344 KB Output is correct
75 Correct 1 ms 344 KB Output is correct
76 Correct 0 ms 344 KB Output is correct
77 Correct 1 ms 344 KB Output is correct
78 Correct 1 ms 500 KB Output is correct
79 Partially correct 1 ms 344 KB Output is partially correct
80 Correct 1 ms 344 KB Output is correct
81 Correct 1 ms 344 KB Output is correct
82 Correct 1 ms 344 KB Output is correct