QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#395565 | #8598. AND Масив | Network_Error | Compile Error | / | / | C++14 | 1.2kb | 2024-04-21 16:17:49 | 2024-04-21 16:17:49 |
Judging History
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 int long long
#define unsigned int
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)==i)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
answer.code: In function ‘void work()’: answer.code:31:12: error: ‘ll’ does not name a type 31 | static ll res[100010],s=0; | ^~ answer.code:33:42: error: ‘s’ was not declared in this scope 33 | if(a[i])ins(a[i],i);else s+=i; | ^ answer.code:34:17: error: ‘ll’ was not declared in this scope 34 | ll &ans=res[i];ans=s*b; | ^~ answer.code:34:21: error: ‘ans’ was not declared in this scope; did you mean ‘ins’? 34 | ll &ans=res[i];ans=s*b; | ^~~ | ins answer.code:34:25: error: ‘res’ was not declared in this scope 34 | ll &ans=res[i];ans=s*b; | ^~~ answer.code:34:36: error: ‘s’ was not declared in this scope 34 | ll &ans=res[i];ans=s*b; | ^ answer.code:44:32: error: ‘res’ was not declared in this scope 44 | for(int i=1;i<=n;i++)cout<<res[i]<<' ';cout<<'\n'; | ^~~