QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#616775 | #8637. 搬砖 | Josephcheng | 0 | 1ms | 9928kb | C++14 | 1.1kb | 2024-10-06 11:25:42 | 2024-10-06 11:25:42 |
answer
#include<bits/stdc++.h>
namespace IO
{
template<typename Type>
void read(Type &x){
char ch=getchar();
x=0;bool f=0;
while(ch<'0'||ch>'9')
f|=(ch=='-'),ch=getchar();
while(ch>='0'&&ch<='9')
x=((x<<1)+(x<<3)+(ch^48)),ch=getchar();
}
}
using namespace std;
#define LL long long
#define N 1000005
int n,ans,top;
int a[N],b[N],c[N],cnt[N];
void cntsort()
{
for(int i=1;i<=top;i++)
cnt[i]=0;
for(int i=1;i<=n;i++)
cnt[c[i]]++;
int t=0;
for(int i=1;i<=top;i++)
while(cnt[i])
c[++t]=i,cnt[i]--;
}
bool chose(int idx)
{
c[idx]--;
cntsort();
int val=c[n];
int sum=0;
for(int i=1;i<=n;i++)
sum+=(c[i]==val);
return !(sum&1);
}
void solve(int topval)
{
for(int i=1;i<=n;i++)
b[i]=a[i]/topval;
for(int i=1;i<=n;i++){
if(!b[i]) continue ;
for(int i=1;i<=n;i++)
c[i]=b[i];
ans+=chose(i);
}
}
int main()
{
// freopen("bricks.in","r",stdin);
// freopen("bricks.out","w",stdout);
IO::read(n);
for(int i=1;i<=n;i++)
IO::read(a[i]),top=max(top,a[i]);
sort(a+1,a+n+1);
for(int i=1;i<=top;i++)
solve(i);
printf("%d",ans);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 9928kb
input:
19 49 87 55 72 26 28 61 89 3 74 68 5 35 38 29 51 43 50 99
output:
774
result:
wrong answer 1st numbers differ - expected: '164', found: '774'
Subtask #2:
score: 0
Time Limit Exceeded
Test #21:
score: 0
Time Limit Exceeded
input:
199999 847249 186487 367355 618072 937226 591328 776261 362189 96203 363974 349368 378905 615535 753238 551029 549551 648843 257850 897199 780171 34956 529292 138489 164016 983045 678158 447625 770688 359626 620193 47041 723226 806679 414396 857650 260257 522075 633910 622445 618277 514235 488164 99...