| Task: | Tekijät |
| Sender: | hltk |
| Submission time: | 2020-11-06 19:21:18 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.05 s | 1, 2, 3 | details |
| #2 | WRONG ANSWER | 0.05 s | 1, 2, 3 | details |
| #3 | WRONG ANSWER | 0.06 s | 2, 3 | details |
| #4 | WRONG ANSWER | 0.06 s | 3 | details |
| #5 | WRONG ANSWER | 0.08 s | 3 | details |
| #6 | WRONG ANSWER | 0.07 s | 3 | details |
| #7 | ACCEPTED | 0.06 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
~~~~~^~~~~~~~~
input/code.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a[i]);
~~~~~^~~~~~~~~~~~Code
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
using namespace std;
using pi = pair<int,int>;
using lint = long long;
const int MAXN = 1000005;
int a[MAXN], b[MAXN], s[MAXN], g[MAXN];
int main(){
int n;
scanf("%d",&n);
for(int i=0; i<n; ++i){
scanf("%d",&a[i]);
s[a[i]]++;
}
for(int i=2; i<MAXN; ++i){
if(b[i]) continue;
lint c = 0;
for(int j=i; j<MAXN; j+=i){
c += s[j];
b[j] = 1;
}
for(int j=i; j<MAXN; j+=i) g[j] += c;
}
lint ans = 0;
for(int i=0; i<n; ++i) ans += g[a[i]] - 1;
printf("%lld\n", lint(n) * (n - 1) / 2 - ans / 2);
}
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 100 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 3043 |
| user output |
|---|
| 2788 |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 100 71 19 26 18 57 78 80 89 31 26 ... |
| correct output |
|---|
| 3086 |
| user output |
|---|
| 2809 |
Test 3
Group: 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 100000 66 87 90 67 93 89 57 29 34 4 8... |
| correct output |
|---|
| 3044751906 |
| user output |
|---|
| 2791095298 |
Test 4
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| 100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 3039650753 |
| user output |
|---|
| 2738866718 |
Test 5
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| 100000 238907 151373 522599 885657 37... |
| correct output |
|---|
| 3031155756 |
| user output |
|---|
| 2726889642 |
Test 6
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| 100000 510510 510510 510510 510510 51... |
| correct output |
|---|
| 0 |
| user output |
|---|
| -30000000000 |
Test 7
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 100000 999983 999983 999983 999983 99... |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
