QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#867495 | #9684. 倾诉 | lgvc# | Compile Error | / | / | C++23 | 4.9kb | 2025-01-23 17:15:15 | 2025-01-23 17:15:16 |
Judging History
This is the latest submission verdict.
- [2025-01-23 17:15:16]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-01-23 17:15:15]
- Submitted
answer
#include <bits/stdc++.h>
#define BIT 61
#define SIZ 35000
struct bitset {
long long bits[SIZ];
void init(void) {for(int i=0;i<SIZ;i++) bits[i]=0;}
void set(int x,bool y) {bits[x/BIT]^=((((bits[x/BIT]>>(x%BIT))&1)^y)<<(x%BIT));}
void setall(bool y) {for(int i=0;i<SIZ;i++) bits[i]=((((long long)y)<<BIT)-(long long)(y));}
bool q(int x) {return (bits[x/BIT]>>(x%BIT))&1;}
void operator=(const bitset& y) {for(int i=0;i<SIZ;i++) bits[i]=y.bits[i];}
void operator|=(const bitset& y) {for(int i=0;i<SIZ;i++) bits[i]|=y.bits[i];}
void operator&=(const bitset& y) {for(int i=0;i<SIZ;i++) bits[i]&=y.bits[i];}
void operator^=(const bitset& y) {for(int i=0;i<SIZ;i++) bits[i]^=y.bits[i];}
void operator+=(const bitset& y) {
for(int i=0;i<SIZ;i++) {
bits[i]+=y.bits[i];
if((bits[i]>>BIT)&1) bits[i]^=(1ll<<BIT),bits[i+1]++;
}
}
void operator-=(const bitset& y) {
for(int i=0;i<SIZ;i++) {
bits[i]-=y.bits[i];
if(bits[i]<0) bits[i]+=(1ll<<BIT),bits[i+1]--;
}
}
void operator<<=(int k) {
bitset z;z.init();
int tmp=k/BIT;
for(int i=0;i<SIZ-tmp;i++) z.bits[i+tmp]=bits[i];
k%=BIT;
z.bits[SIZ-1]<<=k;
for(int i=SIZ-2;i>=0;i--) {
long long tmp=z.bits[i];
z.bits[i]&=((1ll<<(BIT-k))-1);
z.bits[i+1]|=((tmp^z.bits[i])>>(BIT-k));
z.bits[i]<<=k;
}
for(int i=0;i<SIZ;i++) bits[i]=z.bits[i];
}
void operator>>=(int k) {
bitset z;z.init();
int tmp=k/BIT;
for(int i=tmp;i<SIZ;i++) z.bits[i-tmp]=bits[i];
k%=BIT;
z.bits[0]>>=k;
for(int i=1;i<SIZ;i++) {
z.bits[i-1]|=((z.bits[i]&((1ll<<k)-1))<<(BIT-k));
z.bits[i]>>=k;
}
for(int i=0;i<SIZ;i++) bits[i]=z.bits[i];
}
bitset operator|(const bitset& y) {
bitset z;
for(int i=0;i<SIZ;i++) z.bits[i]=bits[i]|y.bits[i];
return z;
}
bitset operator&(const bitset& y) {
bitset z;
for(int i=0;i<SIZ;i++) z.bits[i]=bits[i]&y.bits[i];
return z;
}
bitset operator^(const bitset& y) {
bitset z;
for(int i=0;i<SIZ;i++) z.bits[i]=bits[i]^y.bits[i];
return z;
}
bitset operator+(const bitset& y) {
bitset z;z.bits[0]=0;
for(int i=0;i<SIZ;i++) {
z.bits[i]+=bits[i]+y.bits[i];
if((z.bits[i]>>BIT)&1) z.bits[i]^=(1ll<<BIT),z.bits[i+1]=1;else z.bits[i+1]=0;
}
return z;
}
bitset operator-(const bitset& y) {
bitset z;z.bits[0]=0;
for(int i=0;i<SIZ;i++) {
z.bits[i]+=bits[i]-y.bits[i];
if(z.bits[i]<0) z.bits[i]+=(1ll<<BIT),z.bits[i+1]=-1;else z.bits[i+1]=0;
}
return z;
}
bitset operator<<(int k) {
bitset z;z.init();
int tmp=k/BIT;
for(int i=0;i<SIZ-tmp;i++) z.bits[i+tmp]=bits[i];
k%=BIT;
z.bits[SIZ-1]<<=k;
for(int i=SIZ-2;i>=0;i--) {
long long tmp=z.bits[i];
z.bits[i]&=((1ll<<(BIT-k))-1);
z.bits[i+1]|=((tmp^z.bits[i])>>(BIT-k));
z.bits[i]<<=k;
}
return z;
}
bitset operator>>(int k) {
bitset z;z.init();
int tmp=k/BIT;
for(int i=tmp;i<SIZ;i++) z.bits[i-tmp]=bits[i];
k%=BIT;
z.bits[0]>>=k;
for(int i=1;i<SIZ;i++) {
z.bits[i-1]|=((z.bits[i]&((1ll<<k)-1))<<(BIT-k));
z.bits[i]>>=k;
}
return z;
}
int count(void) {
int ans=0;
for(int i=0;i<SIZ;i++) ans+=__builtin_popcountll(bits[i]);
return ans;
}
bool operator<(const bitset& y) {
for(int i=SIZ-1;i>=0;i--) if(bits[i]^y.bits[i]) return bits[i]<y.bits[i];
return 0;
}
bool operator>(const bitset& y) {
for(int i=SIZ-1;i>=0;i--) if(bits[i]^y.bits[i]) return bits[i]>y.bits[i];
return 0;
}
bool operator<=(const bitset& y) {
for(int i=SIZ-1;i>=0;i--) if(bits[i]^y.bits[i]) return bits[i]<y.bits[i];
return 1;
}
bool operator>=(const bitset& y) {
for(int i=SIZ-1;i>=0;i--) if(bits[i]^y.bits[i]) return bits[i]>y.bits[i];
return 1;
}
bool operator==(const bitset& y) {
for(int i=SIZ-1;i>=0;i--) if(bits[i]^y.bits[i]) return 0;
return 1;
}
};
bitset max(bitset& x,bitset& y) {
for(int i=SIZ-1;i>=0;i--) {
if(x.bits[i]>y.bits[i]) return x;
if(x.bits[i]<y.bits[i]) return y;
}
return x;
}
bitset min(bitset& x,bitset& y) {
for(int i=SIZ-1;i>=0;i--) {
if(x.bits[i]>y.bits[i]) return y;
if(x.bits[i]<y.bits[i]) return x;
}
return x;
}
int T,N,a[20009],K;
bitset f[20009];
bool chk(bitset x) {
int l=N,p=N;
bitset va;
va.setall(0);
while(l) {
va+=(f[l]>>p-l);
if(va>x) {
if(p==l) {
return 0;
}
p--;
va.setall(0);
continue;
} else {
l--;
}
}
return 1;
}
signed main(void) {
scanf("%d",&T);
// T=1;
while(T--) {
std::mt19937 rng(114);
scanf("%d %d",&N,&K);
// N=750;K=10000;
for(int i=1;i<=N;i++) {
scanf("%d",&a[i]);
// a[i]=rng()%1000000+1;
f[i].setall(0);
f[i].bits[0]=a[i];
f[i]<<=N;
}
bitset ff;
for(int i=N+20;i>=0;i--) ff.set(i,1);
for(int i=N+20;i>=0;i--) {
ff.set(i,0);
if(!chk(ff)) {
ff.set(i,1);
}
}
int st=0;
for(int i=N+20;i>=0;i--) {
if(ff.q(i)) {
st=i;
break;
}
}
for(int i=st;i>=0;i--) printf("%d",ff.q(i));
printf("\n");
}
}
Details
answer.code: In function ‘int main()’: answer.code:171:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 171 | scanf("%d",&T); | ~~~~~^~~~~~~~~ answer.code:175:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 175 | scanf("%d %d",&N,&K); | ~~~~~^~~~~~~~~~~~~~~ answer.code:178:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 178 | scanf("%d",&a[i]); | ~~~~~^~~~~~~~~~~~ /tmp/ccBJEHXE.o: in function `chk(bitset)': answer.code:(.text+0x118): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccBJEHXE.o /tmp/ccBJEHXE.o: in function `main': answer.code:(.text.startup+0x31): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/ccBJEHXE.o answer.code:(.text.startup+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/ccBJEHXE.o answer.code:(.text.startup+0x64): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/ccBJEHXE.o answer.code:(.text.startup+0x73): relocation truncated to fit: R_X86_64_PC32 against symbol `K' defined in .bss section in /tmp/ccBJEHXE.o answer.code:(.text.startup+0x7a): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccBJEHXE.o answer.code:(.text.startup+0x8f): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccBJEHXE.o answer.code:(.text.startup+0xa7): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccBJEHXE.o answer.code:(.text.startup+0xeb): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccBJEHXE.o answer.code:(.text.startup+0x35e): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/ccBJEHXE.o answer.code:(.text.startup+0x367): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status