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

Submission #846423

Source Code Expand

Copy
```// tested by Hightail: https://github.com/dj3500/hightail
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <cassert>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cout<<"["<<__LINE__<<"] "<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (__typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

typedef vector<pair<ll,int> > Roz;
Roz res;
for (int d = 2; (ll)d*d <= x; ++d) {
if (x % d == 0) {
int k = 0;
while (x % d == 0) { x /= d; ++k; }
res.pb(mp(d,k));
}
}
if (x != 1) res.pb(mp(x,1));
return res;
}

int main () {
IOS
int n;
cin >> n;
bool has1 = 0;
map<ll,int> m;
map<ll,ll> para;
FOR(i,n) {
ll x;
cin >> x;
x = 1;
ll p = 1;
double dblP = 1;
for (auto it : roz) {
int krot = it.se % 3;
if (krot) { // 1 or 2
FOR(u,krot) {
x *= it.fi;
}
FOR(u,3-krot) {
p *= it.fi;
dblP *= it.fi;
}
}
}
if (x == 1) {
has1 = 1;
} else {
if (dblP > 1001001001001001LL) p = -1;
m[x]++;
m[p];
para[x] = p;
}
}
int res = has1;
for (auto it : m) {
ll x = it.fi;
ll p = para[x];
if (x < p) {
res += max(it.se, m[p]);
}
}
cout << res;
}```

#### Submission Info

Submission Time 2016-08-21 21:36:12+0900 D - Anticube dj3500 C++14 (GCC 5.4.1) 0 2791 Byte WA 5257 ms 20864 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1100
Status
 AC × 2 WA × 1
 AC × 20 WA × 5 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 5253 ms 4224 KB
02.txt TLE 5257 ms 4096 KB
03.txt TLE 5257 ms 4096 KB
04.txt TLE 5257 ms 4224 KB
05.txt TLE 5253 ms 4224 KB
06.txt TLE 5253 ms 4096 KB
07.txt TLE 5257 ms 4224 KB
08.txt TLE 5257 ms 4224 KB
09.txt TLE 5257 ms 4096 KB
10.txt TLE 5257 ms 4224 KB
11.txt TLE 5253 ms 768 KB
12.txt TLE 5257 ms 768 KB
13.txt TLE 5257 ms 4736 KB
14.txt TLE 5253 ms 4736 KB
15.txt TLE 5257 ms 4736 KB
16.txt TLE 5257 ms 4736 KB
17.txt AC 127 ms 256 KB
18.txt AC 131 ms 256 KB
19.txt AC 128 ms 256 KB
20.txt AC 131 ms 256 KB
21.txt TLE 5257 ms 1920 KB
22.txt TLE 5257 ms 1792 KB
23.txt TLE 5257 ms 1792 KB
24.txt TLE 5253 ms 1792 KB
25.txt TLE 5257 ms 1792 KB
26.txt TLE 5257 ms 1792 KB
27.txt AC 358 ms 20864 KB
28.txt AC 15 ms 256 KB
29.txt AC 34 ms 256 KB
30.txt WA 45 ms 256 KB
31.txt AC 44 ms 256 KB
32.txt AC 43 ms 256 KB
33.txt WA 4 ms 256 KB
34.txt AC 117 ms 256 KB
35.txt AC 106 ms 256 KB
36.txt AC 4 ms 256 KB
37.txt TLE 5257 ms 896 KB
38.txt TLE 5253 ms 896 KB
39.txt TLE 5257 ms 896 KB
40.txt TLE 5257 ms 896 KB
41.txt AC 4 ms 256 KB
42.txt AC 4 ms 256 KB
43.txt WA 5 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 WA 5 ms 256 KB