QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#623390 | #8637. 搬砖 | KiharaTouma | 0 | 91ms | 14644kb | C++14 | 913b | 2024-10-09 11:42:56 | 2024-10-09 11:42:56 |
Judging History
answer
//qoj8637
#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
int n, a[N], cnt[N], od[N], tp;
long long ans = 0;
int main(){
scanf("%d", &n);
int mx = 0;
for(int i = 1; i <= n; ++ i){
scanf("%d", &a[i]);
mx = max(mx, a[i]);
++ cnt[a[i]+1];
}
for(int i = 1; i <= mx*2; ++ i){
cnt[i] += cnt[i-1];
}
for(int i = 1; i <= mx; ++ i){
tp = 0;
for(int j = 0; i * j <= mx; ++ j){
if((cnt[i*(j+1)] + cnt[i*j]) & 1){
od[++tp] = j;
}
// printf("%d ", cnt[i*(j+1)] - cnt[i*j]);
}
if(tp == 1 && od[1] == 1){
ans += cnt[i*2] - cnt[i];
} else if(tp == 2 && od[1] + 1 == od[2]){
ans += cnt[i*(od[2]+1)] - cnt[i*od[2]];
}
// puts("");
}
printf("%lld\n", ans);
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: 1ms
memory: 8044kb
input:
19 49 87 55 72 26 28 61 89 3 74 68 5 35 38 29 51 43 50 99
output:
138
result:
wrong answer 1st numbers differ - expected: '164', found: '138'
Subtask #2:
score: 0
Wrong Answer
Test #21:
score: 0
Wrong Answer
time: 91ms
memory: 14644kb
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...
output:
16676097675
result:
wrong answer 1st numbers differ - expected: '19467220030', found: '16676097675'