QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#449603#8598. AND Масивgreen_gold_dog#10 82ms4708kbC++201.6kb2024-06-21 15:17:142024-06-21 15:17:14

Judging History

你现在查看的是最新测评结果

  • [2024-06-21 15:17:14]
  • 评测
  • 测评结果:10
  • 用时:82ms
  • 内存:4708kb
  • [2024-06-21 15:17:14]
  • 提交

answer

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,sse,sse2,sse3,ssse3,sse4,abm,popcnt,mmx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef complex<double> cd;

constexpr ll INF64 = 9'000'000'000'000'000'000, INF32 = 2'000'000'000, MOD = 1'000'000'007;
constexpr db PI = acos(-1);
constexpr bool IS_FILE = false, IS_TEST_CASES = false;

random_device rd;
mt19937 rnd32(rd());
mt19937_64 rnd64(rd());

template<typename T>
bool assign_max(T& a, T b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
bool assign_min(T& a, T b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
T square(T a) {
	return a * a;
}

template<>
struct std::hash<pair<ll, ll>> {
	ll operator() (pair<ll, ll> p) const {
		return ((__int128)p.first * MOD + p.second) % INF64;
	}
};

void solve() {
	ll n, b;
	cin >> n >> b;
	vector<ll> last(b, n);
	vector<ll> arr(n);
	for (ll i = 0; i < n; i++) {
		cin >> arr[i];
		ll x = 0;
		while (arr[i] > 1) {
			arr[i] /= 2;
			x++;
		}
		arr[i] = x;
	}
	vector<ll> ans(n, 0);
	for (ll i = n - 1; i >= 0; i--) {
		last[arr[i]] = i;
		for (ll j = 0; j < b; j++) {
			for (ll k = 0; k < b; k++) {
				if (last[k] != n && k != j) {
					ans[i] += last[k] + 1;
				}
			}
		}
	}
	for (auto i : ans) {
		cout << i << ' ';
	}
	cout << '\n';
}

int main() {
	if (IS_FILE) {
		freopen("", "r", stdin);
		freopen("", "w", stdout);
	}
    	ios_base::sync_with_stdio(false);
    	cin.tie(0);
    	cout.tie(0);
	ll t = 1;
	if (IS_TEST_CASES) {
		cin >> t;
	}
	for (ll i = 0; i < t; i++) {
		solve();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3676kb

input:

2000 20
251931 620255 725521 330111 783060 690627 489092 1019106 84341 631993 231500 920886 604265 342966 152434 588032 469990 805072 809795 12697 699326 433747 754394 567737 603087 199524 539078 775214 872735 454953 106496 93877 933762 36223 211878 168057 53977 782675 171782 455544 869778 47128 955...

output:

91960 92150 92169 92207 92264 92283 92321 92454 92492 92910 92948 93024 93043 93100 93157 93366 93404 93499 93518 93556 96159 96197 96349 96368 96387 96425 96596 96615 96634 96710 96900 96919 97394 97489 97546 97565 97622 97717 97774 98420 98686 98724 100510 100529 100548 100567 100586 100605 100643...

result:

wrong answer 1st lines differ - expected: '10212 4259 4815 9101 17193 176...6 39925 39961 39974 43987 18000', found: '91960 92150 92169 92207 92264 ...3886 113905 113943 75981 38000 '

Subtask #2:

score: 10
Accepted

Test #4:

score: 10
Accepted
time: 82ms
memory: 4644kb

input:

100000 20
262144 16 65536 8 256 1024 32 262144 16 262144 256 1024 1 64 2 131072 4096 2048 2 32 8192 4 2 262144 32768 1 524288 262144 262144 2048 8 64 1 2 8192 131072 256 64 8192 1 262144 4 32 4 524288 1 32768 16 64 128 8192 16 32 4096 16384 16384 4 131072 32768 16384 131072 2 16 2048 32768 16 4 4096...

output:

7752 7885 8018 9329 9842 9956 10070 10317 10355 11096 11362 11856 12958 13205 13547 13623 14003 14706 14934 15010 15447 15713 16093 16302 16378 16796 16929 17271 17290 17518 18164 19114 19228 19361 19893 19969 20387 21147 21356 21584 21698 23332 23370 23560 23807 24510 25688 25916 25992 26486 27322 ...

result:

ok single line: '7752 7885 8018 9329 9842 9956 ...599886 5699943 3799981 1900000 '

Test #5:

score: 0
Accepted
time: 59ms
memory: 4612kb

input:

100000 20
1 8 8 8 8 8 4 8 4 8 2 1 2 1 2 1 4 8 4 2 8 2 1 2 8 4 4 2 1 2 1 4 4 4 2 4 1 8 4 8 1 1 4 2 4 4 8 4 1 8 2 1 2 8 4 8 8 4 2 4 1 2 1 4 4 4 4 1 1 4 8 4 2 2 1 4 8 2 2 4 2 8 8 4 2 1 4 4 8 1 4 4 4 4 8 8 4 8 1 2 1 2 1 1 4 2 8 2 2 2 2 8 2 2 2 4 8 2 8 1 8 4 2 1 1 1 4 8 4 4 8 4 8 2 4 4 4 1 2 4 4 16 1 2 1...

output:

17159147 17159356 17159375 17159394 17159413 17159432 17159470 17159508 17159546 17159698 17159850 17159888 17159926 17159964 17160002 17160097 17160230 17160268 17160325 17160458 17160496 17160572 17160610 17160724 17160800 17161047 17161066 17161161 17161199 17161237 17161332 17161446 17161465 171...

result:

ok single line: '17159147 17159356 17159375 171...899943 1899962 1899981 1900000 '

Subtask #3:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 12ms
memory: 4708kb

input:

100000 8
98 78 5 190 79 234 162 79 118 176 115 130 10 9 233 56 97 15 148 13 46 87 92 65 150 62 50 46 159 101 48 86 203 71 29 124 23 228 55 161 240 80 139 74 251 143 167 207 183 52 50 252 17 185 40 145 167 164 227 166 172 60 182 62 173 227 232 243 251 134 109 241 44 33 217 149 51 6 110 201 242 196 23...

output:

3913 3920 3941 4466 4480 4501 4508 4529 4536 4550 4564 4606 4627 4634 4662 4690 4725 4760 4774 4816 5292 5327 5334 5341 5383 5411 5418 5425 5446 5474 5488 5544 5558 5593 5607 5621 5663 5775 5789 5866 5873 5887 5901 5915 6104 6111 6118 6125 6132 6153 6160 6188 6202 6468 6482 6531 6538 6545 6552 6559 ...

result:

wrong answer 1st lines differ - expected: '152631657 152630131 152630001 ...4 1199980 1199981 699995 500000', found: '3913 3920 3941 4466 4480 4501 ...2099965 2099979 1399993 700000 '

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%