QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#488271#8598. AND МасивYarema#10 1233ms15220kbC++201.0kb2024-07-23 19:33:572024-07-23 19:33:58

Judging History

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

  • [2024-07-23 19:33:58]
  • 评测
  • 测评结果:10
  • 用时:1233ms
  • 内存:15220kb
  • [2024-07-23 19:33:57]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, b;
	cin >> n >> b;
	
	VI a(n);
	FOR (i, 0, n)
		cin >> a[i];
	
	vector<VI> nxt(n + 1, VI(b, n));
	RFOR (i, n, 0)
	{
		nxt[i] = nxt[i + 1];
		nxt[i][__builtin_ctz(a[i])] = i;
	}
	FOR (i, 0, n)
	{
		int res = 0;
		FOR (bb, 0, b)
		{
			int mask = 1 << bb;
			int j = i;
			while (true)
			{
				int mn = n;
				FOR (bbb, 0, b)
				{
					if (mask & (1 << bbb))
						continue;
					mn = min(mn, nxt[j][bbb]);
				}
				if (mn == n) break;
				j = mn;
				mask |= a[j];
				res += j + 1;
			}
			
		}
		cout << res << ' ';
	}
	cout << '\n';
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 7ms
memory: 3768kb

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:

4081 4688 1368 2329 1227 1589 1281 3113 2688 12995 3083 2232 613 1447 3410 2116 1843 2521 3368 5017 1199 3162 1418 2211 6445 1865 6421 24694 27051 6455 2862 2273 1408 2347 1484 2478 5229 4430 3516 4391 7030 7488 7700 11032 28056 27733 28966 13227 5747 12612 21658 20689 23408 7406 11949 7749 12989 11...

result:

wrong answer 1st lines differ - expected: '10212 4259 4815 9101 17193 176...6 39925 39961 39974 43987 18000', found: '4081 4688 1368 2329 1227 1589 ... 77866 39942 75943 75981 38000 '

Subtask #2:

score: 10
Accepted

Test #4:

score: 10
Accepted
time: 1233ms
memory: 15164kb

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: 10
Accepted
time: 415ms
memory: 15220kb

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: 69ms
memory: 10488kb

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:

747 422 1335 253 251 187 390 600 2309 584 852 1507 1439 1626 612 1029 1003 1891 1652 2102 2595 2464 1285 1379 1519 1586 1787 1631 1565 3402 1222 1489 906 1570 1991 2818 2071 1134 2156 1280 1162 1628 2207 1311 951 2243 2639 1357 2089 3061 1327 1390 2936 2613 2957 1961 1824 2006 1631 2741 2677 2590 21...

result:

wrong answer 1st lines differ - expected: '152631657 152630131 152630001 ...4 1199980 1199981 699995 500000', found: '747 422 1335 253 251 187 390 6... 899976 1399979 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%