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

Submission #846463

Source Code Expand

Copy
```#include <iostream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int BUBEN = 2200;

int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.precision(10);
cout << fixed;
#ifdef LOCAL_DEFINE
freopen("input.txt", "rt", stdin);
#endif

int n;
cin >> n;
vi64 a(n);
forn(i, n) cin >> a[i];
map< vector<pi64>, int > m;
for (i64 x: a) {
map<i64, int> v;
i64 y = x;
for (int i = 2; i <= BUBEN; ++i) {
int z = 0;
while (y % i == 0) y /= i, ++z;
if (z % 3 == 1) v[i] = 1;
if (z % 3 == 2) v[i] = -1;
}
if (y > 1) {
i64 t = sqrt(y);
while (t * t < y) ++t;
if (t * t == y) v[t] = -1;
else v[y] = 1;
}
vector<pi64> vv;
for (auto w: v) vv.pb(mp(w.fi, w.se));
++m[vv];
}

int ans = 0;
for (auto w: m) {
vector<pi64> v = w.fi, u = v;
if (v.empty()) {
++ans;
continue;
}
for (auto &x: u) x.se = -x.se;
if (m.count(u) && u < v) continue;
int res = w.se;
if (m.count(u)) uax(res, m[u]);
ans += res;
}
cout << ans << '\n';

#ifdef LOCAL_DEFINE
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
return 0;
}
```

#### Submission Info

Submission Time 2016-08-21 21:37:15+0900 D - Anticube endagorion C++14 (GCC 5.4.1) 1100 2464 Byte AC 4205 ms 15488 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 1100 / 1100
Status
 AC × 3
 AC × 51
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 4140 ms 15488 KB
02.txt AC 4178 ms 15488 KB
03.txt AC 4151 ms 15488 KB
04.txt AC 4159 ms 15488 KB
05.txt AC 4205 ms 15488 KB
06.txt AC 4156 ms 15488 KB
07.txt AC 4128 ms 15488 KB
08.txt AC 4197 ms 15488 KB
09.txt AC 4180 ms 15488 KB
10.txt AC 4099 ms 15488 KB
11.txt AC 3862 ms 4480 KB
12.txt AC 3920 ms 4480 KB
13.txt AC 3928 ms 5120 KB
14.txt AC 3879 ms 5120 KB
15.txt AC 3884 ms 5120 KB
16.txt AC 3883 ms 5120 KB
17.txt AC 3853 ms 1024 KB
18.txt AC 3891 ms 1024 KB
19.txt AC 3878 ms 1024 KB
20.txt AC 3873 ms 1024 KB
21.txt AC 4039 ms 8576 KB
22.txt AC 4014 ms 8576 KB
23.txt AC 3983 ms 8704 KB
24.txt AC 4030 ms 8576 KB
25.txt AC 3996 ms 8576 KB
26.txt AC 4032 ms 8576 KB
27.txt AC 4056 ms 12288 KB
28.txt AC 3749 ms 1024 KB
29.txt AC 3739 ms 1024 KB
30.txt AC 3779 ms 1024 KB
31.txt AC 3770 ms 1024 KB
32.txt AC 3779 ms 1024 KB
33.txt AC 4 ms 256 KB
34.txt AC 3911 ms 1024 KB
35.txt AC 3812 ms 1024 KB
36.txt AC 4 ms 256 KB
37.txt AC 3927 ms 5376 KB
38.txt AC 3949 ms 5376 KB
39.txt AC 3930 ms 5504 KB
40.txt AC 3912 ms 5504 KB
41.txt AC 4 ms 256 KB
42.txt AC 4 ms 256 KB
43.txt AC 4 ms 256 KB
44.txt AC 4 ms 256 KB
45.txt AC 4 ms 256 KB
46.txt AC 4 ms 256 KB
47.txt AC 5 ms 256 KB
48.txt AC 5 ms 256 KB
s1.txt AC 5 ms 256 KB
s2.txt AC 5 ms 256 KB
s3.txt AC 5 ms 256 KB