Contest Duration: - (local time) (110 minutes) Back to Home

Submission #846346

Source Code Expand

Copy
```#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int MAX_N = 100030;    // Change as necessary
const ll  MODD = 1000000009; //

vector<ll> pr;
bool is_prime[MAX_N];

vector<pair<ll,int> > factor(long long x){
vector<pair<ll,int> > ans;
for(auto p : pr){
if(p*p > x) break;
if(x % p == 0){
int ctr = 0;
while(x % p == 0){
x /= p;
ctr++;
}

if(ctr % 3)
ans.emplace_back(p,ctr%3);
}
}
if(x != 1) ans.emplace_back(x,1);
return ans;
}

ll A[MAX_N];
map<vector<pair<ll,int> >, int> M;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);

pr.push_back(2);
fill(is_prime,is_prime+MAX_N,true);
for(int i=3;i*i<MAX_N;i++)
if(is_prime[i])
for(int j=i*i;j<MAX_N;j++)
is_prime[j] = false;

for(int i=3;i<MAX_N;i+=2)
if(is_prime[i])
pr.push_back(i);

int n; cin >> n;
for(int i=0;i<n;i++) cin >> A[i];

for(int i=0;i<n;i++)
M[factor(A[i])]++;

int ans = 0;
for(const auto& x : M){
vector<pair<ll,int> > tmp = x.first;
bool found = false;
for(auto& p : tmp){
p.second = (3-p.second)%3;
found |= p.second;
}

if(!found) ans+=2;
else if(M.count(tmp)){
ans += max((ll)x.second,(ll)M[tmp]);
} else {
ans += x.second*2;
}
}

cout << ans/2 << endl;

return 0;
}
```

#### Submission Info

Submission Time 2016-08-21 21:34:06+0900 D - Anticube MathCrusader C++14 (GCC 5.4.1) 0 1458 Byte WA 216 ms 14080 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1100
Status
 AC × 3
 AC × 36 WA × 15
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 216 ms 14080 KB
02.txt AC 192 ms 14080 KB
03.txt AC 195 ms 14080 KB
04.txt AC 196 ms 14080 KB
05.txt AC 195 ms 14080 KB
06.txt AC 196 ms 14080 KB
07.txt AC 196 ms 14080 KB
08.txt AC 196 ms 14080 KB
09.txt AC 192 ms 14080 KB
10.txt AC 191 ms 14080 KB
11.txt AC 100 ms 4608 KB
12.txt AC 102 ms 4608 KB
13.txt WA 104 ms 5248 KB
14.txt WA 102 ms 5248 KB
15.txt WA 102 ms 5248 KB
16.txt WA 102 ms 5248 KB
17.txt AC 124 ms 1152 KB
18.txt AC 126 ms 1152 KB
19.txt AC 126 ms 1152 KB
20.txt AC 125 ms 1152 KB
21.txt WA 158 ms 8320 KB
22.txt WA 157 ms 8320 KB
23.txt WA 156 ms 8320 KB
24.txt WA 157 ms 8320 KB
25.txt WA 157 ms 8320 KB
26.txt WA 155 ms 8320 KB
27.txt WA 160 ms 12032 KB
28.txt AC 18 ms 1152 KB
29.txt AC 31 ms 1152 KB
30.txt AC 49 ms 1152 KB
31.txt AC 45 ms 1152 KB
32.txt AC 45 ms 1152 KB
33.txt AC 5 ms 384 KB
34.txt AC 119 ms 1152 KB
35.txt AC 97 ms 1152 KB
36.txt AC 5 ms 384 KB
37.txt WA 114 ms 5504 KB
38.txt WA 112 ms 5504 KB
39.txt WA 115 ms 5504 KB
40.txt WA 113 ms 5504 KB
41.txt AC 5 ms 384 KB
42.txt AC 5 ms 384 KB
43.txt AC 5 ms 384 KB
44.txt AC 5 ms 384 KB
45.txt AC 5 ms 384 KB
46.txt AC 5 ms 384 KB
47.txt AC 5 ms 384 KB
48.txt AC 5 ms 384 KB
s1.txt AC 5 ms 384 KB
s2.txt AC 5 ms 384 KB
s3.txt AC 5 ms 384 KB