QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#449602 | #8598. AND Масив | green_gold_dog# | 0 | 81ms | 4664kb | C++20 | 1.6kb | 2024-06-21 15:16:49 | 2024-06-21 15:16:50 |
Judging History
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];
}
}
}
}
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: 3580kb
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:
91713 91903 91922 91960 92017 92036 92074 92207 92245 92663 92701 92777 92796 92853 92910 93119 93157 93252 93271 93309 95912 95950 96102 96121 96140 96178 96349 96368 96387 96463 96653 96672 97147 97242 97299 97318 97375 97470 97527 98173 98439 98477 100263 100282 100301 100320 100339 100358 100396...
result:
wrong answer 1st lines differ - expected: '10212 4259 4815 9101 17193 176...6 39925 39961 39974 43987 18000', found: '91713 91903 91922 91960 92017 ...3829 113848 113886 75943 37981 '
Subtask #2:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 81ms
memory: 4664kb
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:
7372 7505 7638 8949 9462 9576 9690 9937 9975 10716 10982 11476 12578 12825 13167 13243 13623 14326 14554 14630 15067 15333 15713 15922 15998 16416 16549 16891 16910 17138 17784 18734 18848 18981 19513 19589 20007 20767 20976 21204 21318 22952 22990 23180 23427 24130 25308 25536 25612 26106 26942 279...
result:
wrong answer 1st lines differ - expected: '7752 7885 8018 9329 9842 9956 ...7599886 5699943 3799981 1900000', found: '7372 7505 7638 8949 9462 9576 ...599810 5699886 3799943 1899981 '
Subtask #3:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 17ms
memory: 4624kb
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:
3857 3864 3885 4410 4424 4445 4452 4473 4480 4494 4508 4550 4571 4578 4606 4634 4669 4704 4718 4760 5236 5271 5278 5285 5327 5355 5362 5369 5390 5418 5432 5488 5502 5537 5551 5565 5607 5719 5733 5810 5817 5831 5845 5859 6048 6055 6062 6069 6076 6097 6104 6132 6146 6412 6426 6475 6482 6489 6496 6503 ...
result:
wrong answer 1st lines differ - expected: '152631657 152630131 152630001 ...4 1199980 1199981 699995 500000', found: '3857 3864 3885 4410 4424 4445 ...2099944 2099958 1399979 699993 '
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%