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

Submission #847241

Source Code Expand

Copy
```#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <sstream>
#include <map>
using namespace std;
using ll = long long;

class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;
public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}};

int main() {
map<ll, int> sqs;
for (ll i = 3; i <= 100000; ++i) {
sqs[i * i] = i;
}

int N;
while (scanf("%d", &N) != EOF) {
map<vector<ll>, int> cnt;

for (int i : range(N)) {
ll x;
scanf("%lld", &x);

vector<ll> v;
//for (int i = 2; i * i <= 100000; ++i) {
for (int i = 2; i <= 2160; ++i) {
if (x % i != 0) continue;
ll r = 0;
while (x % i == 0) {
x /= i;
r = (r + 1) % 3;
}
if (r) {
v.push_back(i);
v.push_back(r);
}
}

if (x > 1) {
if (sqs.find(x) != sqs.end()) {
v.push_back(sqs[x]);
v.push_back(2);
} else {
v.push_back(x);
v.push_back(1);
}
}

//for (auto y : v) cout << y << " " ;
//cout << endl;
cnt[v]++;
}

ll res = 0;
for (auto& it : cnt) {
vector<ll> now = it.first, cmp = now;
if (now.size() == 0) {
// special element
res += 1;
continue;
}

for (int i = 1; i < cmp.size(); i += 2) cmp[i] = 3 - cmp[i];
if (cnt.find(cmp) != cnt.end() && now > cmp) continue;

res += max(it.second, cnt[cmp]);
}
printf("%lld\n", res);
}
}
```

#### Submission Info

Submission Time 2016-08-21 22:02:51+0900 D - Anticube ir5 C++14 (GCC 5.4.1) 1100 1811 Byte AC 4148 ms 35200 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:29:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld", &x);
^
```

#### 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 4148 ms 35200 KB
02.txt AC 4118 ms 35072 KB
03.txt AC 4147 ms 35072 KB
04.txt AC 4146 ms 35200 KB
05.txt AC 4125 ms 35200 KB
06.txt AC 4091 ms 35200 KB
07.txt AC 4112 ms 35200 KB
08.txt AC 4079 ms 35072 KB
09.txt AC 4092 ms 35072 KB
10.txt AC 4063 ms 35072 KB
11.txt AC 3864 ms 13312 KB
12.txt AC 3851 ms 13312 KB
13.txt AC 3796 ms 13312 KB
14.txt AC 3861 ms 13312 KB
15.txt AC 3834 ms 13312 KB
16.txt AC 3807 ms 13440 KB
17.txt AC 3739 ms 6528 KB
18.txt AC 3731 ms 6528 KB
19.txt AC 3749 ms 6528 KB
20.txt AC 3732 ms 6528 KB
21.txt AC 3939 ms 21376 KB
22.txt AC 3905 ms 21248 KB
23.txt AC 3911 ms 21376 KB
24.txt AC 3907 ms 21376 KB
25.txt AC 3921 ms 21248 KB
26.txt AC 3928 ms 21248 KB
27.txt AC 3970 ms 28672 KB
28.txt AC 3675 ms 6528 KB
29.txt AC 3622 ms 6528 KB
30.txt AC 3653 ms 6528 KB
31.txt AC 3643 ms 6528 KB
32.txt AC 3658 ms 6528 KB
33.txt AC 56 ms 6528 KB
34.txt AC 3730 ms 6528 KB
35.txt AC 3682 ms 6528 KB
36.txt AC 56 ms 6528 KB
37.txt AC 3862 ms 15232 KB
38.txt AC 3857 ms 15232 KB
39.txt AC 3883 ms 15232 KB
40.txt AC 3870 ms 15232 KB
41.txt AC 57 ms 6528 KB
42.txt AC 57 ms 6528 KB
43.txt AC 57 ms 6528 KB
44.txt AC 55 ms 6528 KB
45.txt AC 58 ms 6528 KB
46.txt AC 54 ms 6528 KB
47.txt AC 55 ms 6528 KB
48.txt AC 56 ms 6528 KB
s1.txt AC 55 ms 6528 KB
s2.txt AC 56 ms 6528 KB
s3.txt AC 55 ms 6528 KB