Submission #848211


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> PII;
typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pct __builtin_popcount

#define INF 10000000010LL

int p[1000], pb[1000], L; ll pc[1000]; 
int n; map<ll, int> F; map<ll, ll> ra;
set<ll> C;

int main () {
	for (int i = 2; i < 3000; i ++) {
		bool F = 1;
		for (int j = 2; j*j <= i; j ++) 
			if (i%j == 0) {F = 0; break;}
		if (F) {
			p[L] = i;
			pb[L] = i*i;
			pc[L] = (ll)i*i*i;
			L ++;
		}
	}
	cin >> n;
	int S = 0;
	bool F1 = 0;
	for (int i = 0; i < n; i ++) {
		ll x;
		cin >> x;
		ll y = 1;
		ll x1 = 1;
		for (int j = 0; x != x1 && j < L; j ++) {
			while (x%pc[j] == 0) {
				x /= pc[j];
			}
			if (x%pb[j] == 0) {
				y *= p[j];
				x1 *= pb[j];
				if (y > INF) y = INF;
			} else
			if (x%p[j] == 0) {
				y *= pb[j];
				x1 *= p[j];
				if (y > INF) y = INF;
			}
		}
		x /= x1;
		if (y >= INF) {
			S ++; continue;
		}
		if (x != 1) {
			int c = sqrt(x); int cc = -1; 
			for (int d = max(1, c-10); d <= c+10; d ++)
				if ((ll)d*d == x) {
					cc = d; break;
				}
			if (cc == -1) {
				if (INF/x/x < y) {S ++; continue;}
				y *= x; y *= x;
			} else {
				y *= cc;
			}
		}
		if (y >= INF) {
			S ++; continue;
		}
		x *= x1;
		if (x == 1) {
			if (!F1) {
				F1 = 1;
				S ++;
			}
			continue;
		}
		F[x] ++;
		ra[x] = y;
	}
	
	for (map<ll,int>::iterator i = F.begin(); i != F.end(); i ++) {
		ll r = ra[i->fi];
		if (i->fi < r) {
			S += max(i->se, F[r]);
		}
	}
	cout << S << endl;
	return 0;
}

Submission Info

Submission Time
Task D - Anticube
User sevenkplus
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1649 Byte
Status WA
Exec Time 2262 ms
Memory 20864 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1100
Status
AC × 3
AC × 25
WA × 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 WA 2183 ms 256 KB
02.txt WA 2184 ms 256 KB
03.txt WA 2190 ms 256 KB
04.txt WA 2182 ms 384 KB
05.txt WA 2180 ms 256 KB
06.txt WA 2181 ms 256 KB
07.txt WA 2179 ms 256 KB
08.txt WA 2179 ms 256 KB
09.txt WA 2185 ms 256 KB
10.txt WA 2180 ms 256 KB
11.txt AC 2256 ms 256 KB
12.txt AC 2255 ms 256 KB
13.txt WA 2262 ms 2304 KB
14.txt WA 2253 ms 2304 KB
15.txt WA 2259 ms 2304 KB
16.txt WA 2253 ms 2304 KB
17.txt AC 125 ms 256 KB
18.txt AC 125 ms 256 KB
19.txt AC 124 ms 256 KB
20.txt AC 125 ms 256 KB
21.txt WA 1732 ms 1280 KB
22.txt WA 1708 ms 1280 KB
23.txt WA 1712 ms 1280 KB
24.txt WA 1712 ms 1280 KB
25.txt WA 1709 ms 1280 KB
26.txt WA 1708 ms 1280 KB
27.txt AC 1331 ms 20864 KB
28.txt AC 31 ms 256 KB
29.txt AC 44 ms 256 KB
30.txt WA 47 ms 256 KB
31.txt AC 50 ms 256 KB
32.txt AC 50 ms 256 KB
33.txt AC 4 ms 256 KB
34.txt AC 123 ms 256 KB
35.txt AC 116 ms 256 KB
36.txt AC 4 ms 256 KB
37.txt WA 2164 ms 512 KB
38.txt WA 2163 ms 512 KB
39.txt WA 2163 ms 512 KB
40.txt WA 2169 ms 512 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 WA 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