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

Submission #846329

Source Code Expand

Copy
```// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0, _n = (int)(n); i < _n; ++i)

const int N = (int) 1e5 + 5, mod = 0;

int pr[N];
long long a[N];
vector<int> p;
map<long long, int> mp;
long long s[N], o[N];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
for (int i = 2; i < N; ++i) if (!pr[i]) {
for (int j = i; j < N; j += i)
pr[j] = 0;
p.push_back(i);
}
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
long long x = a[i], y = 1, self = 1;
for (int j : p) {
if (j * 1ll * j > x) {
break;
}
int cnt = 0;
while (x % j == 0) cnt++, x /= j;
cnt %= 3;
for (int q = 0; q < cnt; ++q)
self *= j;
for (int q = 0; q < (3 - cnt) % 3; ++q)
y *= j;
}
if (x != 1) {
self *= x;
y *= x * x;
}
s[i] = self;
o[i] = y;
mp[self]++;
mp[y]--;
}
int res = 0;
for (int i = 0; i < n; ++i) {
if (mp[s[i]] >= 0) {
res++;
mp[o[i]] = -1;
}
}
cout << res;

}

```

#### Submission Info

Submission Time 2016-08-21 21:33:44+0900 D - Anticube Reyna C++14 (GCC 5.4.1) 0 1619 Byte TLE 5257 ms 13688 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1100
Status
 AC × 3
 AC × 25 TLE × 26
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 TLE 5257 ms 5368 KB
02.txt TLE 5257 ms 5368 KB
03.txt TLE 5257 ms 5368 KB
04.txt TLE 5257 ms 5496 KB
05.txt TLE 5257 ms 5496 KB
06.txt TLE 5257 ms 5368 KB
07.txt TLE 5257 ms 5496 KB
08.txt TLE 5257 ms 5368 KB
09.txt TLE 5257 ms 5368 KB
10.txt TLE 5257 ms 5496 KB
11.txt TLE 5257 ms 1656 KB
12.txt TLE 5257 ms 1656 KB
13.txt TLE 5257 ms 4856 KB
14.txt TLE 5257 ms 4856 KB
15.txt TLE 5257 ms 4856 KB
16.txt TLE 5257 ms 4856 KB
17.txt AC 121 ms 3448 KB
18.txt AC 121 ms 3448 KB
19.txt AC 121 ms 3448 KB
20.txt AC 121 ms 3448 KB
21.txt TLE 5257 ms 2680 KB
22.txt TLE 5257 ms 2680 KB
23.txt TLE 5257 ms 2680 KB
24.txt TLE 5257 ms 2680 KB
25.txt TLE 5257 ms 2680 KB
26.txt TLE 5257 ms 2680 KB
27.txt AC 278 ms 13688 KB
28.txt AC 25 ms 3448 KB
29.txt AC 37 ms 3448 KB
30.txt AC 41 ms 3448 KB
31.txt AC 39 ms 3448 KB
32.txt AC 39 ms 3448 KB
33.txt AC 11 ms 1276 KB
34.txt AC 113 ms 3448 KB
35.txt AC 104 ms 3448 KB
36.txt AC 10 ms 1276 KB
37.txt TLE 5257 ms 1784 KB
38.txt TLE 5257 ms 1784 KB
39.txt TLE 5257 ms 1784 KB
40.txt TLE 5257 ms 1784 KB
41.txt AC 10 ms 1276 KB
42.txt AC 11 ms 1276 KB
43.txt AC 13 ms 1276 KB
44.txt AC 11 ms 1276 KB
45.txt AC 11 ms 1276 KB
46.txt AC 11 ms 1276 KB
47.txt AC 11 ms 1276 KB
48.txt AC 12 ms 1276 KB
s1.txt AC 11 ms 1276 KB
s2.txt AC 11 ms 1276 KB
s3.txt AC 12 ms 1276 KB