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

Submission #846124

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 >= BUBEN * BUBEN) {
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:29:05+0900 D - Anticube endagorion C++14 (GCC 5.4.1) 0 2477 Byte WA 4045 ms 12544 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1100
Status
 AC × 3
 AC × 24 WA × 27
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 WA 3977 ms 12544 KB
02.txt WA 3987 ms 12544 KB
03.txt WA 3985 ms 12544 KB
04.txt WA 3966 ms 12544 KB
05.txt WA 3961 ms 12544 KB
06.txt WA 3995 ms 12544 KB
07.txt WA 3954 ms 12544 KB
08.txt WA 3951 ms 12544 KB
09.txt WA 4045 ms 12544 KB
10.txt WA 3968 ms 12544 KB
11.txt WA 3803 ms 4480 KB
12.txt WA 3826 ms 4480 KB
13.txt WA 3756 ms 1920 KB
14.txt WA 3728 ms 1920 KB
15.txt WA 3723 ms 1920 KB
16.txt WA 3729 ms 1920 KB
17.txt AC 3826 ms 1024 KB
18.txt AC 3827 ms 1024 KB
19.txt AC 3834 ms 1024 KB
20.txt AC 3835 ms 1024 KB
21.txt WA 3857 ms 6400 KB
22.txt WA 3858 ms 6400 KB
23.txt WA 3939 ms 6400 KB
24.txt WA 3887 ms 6528 KB
25.txt WA 3870 ms 6528 KB
26.txt WA 3866 ms 6528 KB
27.txt WA 3887 ms 8064 KB
28.txt AC 3695 ms 1024 KB
29.txt AC 3708 ms 1024 KB
30.txt AC 3741 ms 1024 KB
31.txt AC 3744 ms 1024 KB
32.txt AC 3743 ms 1024 KB
33.txt AC 4 ms 256 KB
34.txt AC 3815 ms 1024 KB
35.txt AC 3768 ms 1024 KB
36.txt AC 4 ms 256 KB
37.txt WA 3816 ms 4992 KB
38.txt WA 3832 ms 4992 KB
39.txt WA 3851 ms 4992 KB
40.txt WA 3833 ms 4992 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 4 ms 256 KB
48.txt AC 4 ms 256 KB
s1.txt AC 4 ms 256 KB
s2.txt AC 4 ms 256 KB
s3.txt AC 4 ms 256 KB