QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#395557#8598. AND МасивNetwork_Error0 933ms8948kbC++141.2kb2024-04-21 16:14:422024-04-21 16:14:42

Judging History

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

  • [2024-04-21 16:14:42]
  • 评测
  • 测评结果:0
  • 用时:933ms
  • 内存:8948kb
  • [2024-04-21 16:14:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define piii tuple<int,int,int>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define deb(var) cerr<<#var<<'='<<(var)<<"; "
#define ll long long
int n,b,a[100010],buc[(1<<20)+5]; 
void chkmn(int &x,int y){if(x>y)x=y;}
const int B=15,S=(1<<B)-1;
void ins(unsigned x,int r){
	unsigned p=x&S,q=x>>B<<B;
	for(unsigned i=0;i<S;i++)
		if((p|i)==p)chkmn(buc[q|i],r);
}
int find(unsigned x){
	int ans=1e9;
	unsigned p=x>>B,q=x&S;
	for(unsigned i=0;i<(1<<(20-B));i++)
		if((p&i)==i)chkmn(ans,buc[i<<B|q]);return ans;
}
void work(){
	memset(buc,0x1f,sizeof buc);
	cin>>n>>b;
	for(int i=1;i<=n;i++)cin>>a[i];
    static ll res[100010],s=0;
	for(int i=n;i;i--){
		if(a[i])ins(a[i],i);else s+=i;
		ll &ans=res[i];ans=s*b;
		for(int _=0,pos;_<b;_++){
			unsigned bit=1<<_;
			while(1){
				pos=find(1048575^bit);
				if(pos>n)break;
				ans+=pos;bit|=a[pos]; 
			}
		}
	}
    for(int i=1;i<=n;i++)cout<<res[i]<<' ';cout<<'\n';
}
signed main(){
	ios::sync_with_stdio(0),
	cin.tie(0),cout.tie(0);
	int T=1;while(T--)work();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: 19ms
memory: 8700kb

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:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

wrong answer 1st lines differ - expected: '10212 4259 4815 9101 17193 176...6 39925 39961 39974 43987 18000', found: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Subtask #2:

score: 0
Wrong Answer

Test #4:

score: 0
Wrong Answer
time: 933ms
memory: 8948kb

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:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

wrong answer 1st lines differ - expected: '7752 7885 8018 9329 9842 9956 ...7599886 5699943 3799981 1900000', found: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Subtask #3:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 918ms
memory: 8884kb

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:

152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 152628168 ...

result:

wrong answer 1st lines differ - expected: '152631657 152630131 152630001 ...4 1199980 1199981 699995 500000', found: '152628168 152628168 152628168 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%