Submission #4277541
Source Code Expand
#include<bits/stdc++.h> #define X first #define Y second #define pb emplace_back #define FOR(i,a,b) for(int (i)=(a);i<(b);++(i)) #define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i)) #define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X)) #define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X)) #define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X)) #define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X)) #define all(X) (X).begin(),(X).end() #define rall(X) (X).rbegin(),(X).rend() #define eb emplace_back #define UNIQUE(X) (X).erase(unique(all(X)),(X).end()) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef ll LL; typedef pii PII; typedef pll PLL; template<class T> using vv=vector<vector<T>>; template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;} template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;} const ll MOD=1e9+7; int N; map<LL, int> cnt; const int L = 2155; bool is_composite[L]; vector<LL> ps; LL Reduce(LL v) { for (LL p : ps) { while (v%p == 0) v /= p; } return v; } int main() { reps(i, 2, L) { if (is_composite[i]) continue; LL p = i; ps.eb(p*p*p); for (int j=i+i; j<L; j+=i) { is_composite[j] = true; } } //cout << ps.size() << endl; scanf("%d", &N); rep(i, N) { LL s; scanf("%lld", &s); cnt[Reduce(s)]++; } int ans = N; const LL LIM = 1e6; for (auto &p : cnt) { LL v = p.X; int a = p.Y; //printf("%lld: %d\n", v, a); if (v > LIM) continue; LL r = Reduce(v*v); if (!cnt.count(r)) continue; int b = cnt[r]; if (a > b) continue; if (a == b && v < r) continue; //printf("removed (%lld,%d) because of (%lld, %d)\n", v, a, r, b); ans -= a; } if (cnt.count(1)) ans++; printf("%d\n", ans); }
Submission Info
Submission Time | |
---|---|
Task | D - Anticube |
User | potetisensei |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1885 Byte |
Status | WA |
Exec Time | 702 ms |
Memory | 6528 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:53:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ^ ./Main.cpp:56:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld", &s); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1100 | ||||||
Status |
|
|
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 | 412 ms | 6528 KB |
02.txt | AC | 408 ms | 6528 KB |
03.txt | AC | 411 ms | 6528 KB |
04.txt | AC | 410 ms | 6528 KB |
05.txt | AC | 410 ms | 6528 KB |
06.txt | AC | 417 ms | 6528 KB |
07.txt | AC | 415 ms | 6528 KB |
08.txt | AC | 410 ms | 6528 KB |
09.txt | AC | 408 ms | 6528 KB |
10.txt | AC | 408 ms | 6528 KB |
11.txt | AC | 374 ms | 2176 KB |
12.txt | AC | 373 ms | 2176 KB |
13.txt | WA | 488 ms | 2560 KB |
14.txt | WA | 484 ms | 2560 KB |
15.txt | WA | 482 ms | 2560 KB |
16.txt | WA | 480 ms | 2560 KB |
17.txt | AC | 367 ms | 256 KB |
18.txt | AC | 366 ms | 256 KB |
19.txt | AC | 367 ms | 256 KB |
20.txt | AC | 366 ms | 256 KB |
21.txt | WA | 451 ms | 4096 KB |
22.txt | WA | 448 ms | 4096 KB |
23.txt | WA | 449 ms | 4096 KB |
24.txt | WA | 448 ms | 4096 KB |
25.txt | WA | 448 ms | 4096 KB |
26.txt | WA | 449 ms | 4096 KB |
27.txt | AC | 702 ms | 5504 KB |
28.txt | AC | 338 ms | 256 KB |
29.txt | AC | 353 ms | 256 KB |
30.txt | AC | 347 ms | 256 KB |
31.txt | AC | 347 ms | 256 KB |
32.txt | AC | 348 ms | 256 KB |
33.txt | AC | 1 ms | 256 KB |
34.txt | AC | 362 ms | 256 KB |
35.txt | AC | 362 ms | 256 KB |
36.txt | AC | 1 ms | 256 KB |
37.txt | WA | 397 ms | 2688 KB |
38.txt | WA | 394 ms | 2688 KB |
39.txt | WA | 394 ms | 2688 KB |
40.txt | WA | 394 ms | 2688 KB |
41.txt | AC | 1 ms | 256 KB |
42.txt | AC | 1 ms | 256 KB |
43.txt | AC | 1 ms | 256 KB |
44.txt | AC | 1 ms | 256 KB |
45.txt | AC | 1 ms | 256 KB |
46.txt | AC | 1 ms | 256 KB |
47.txt | AC | 1 ms | 256 KB |
48.txt | AC | 1 ms | 256 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |
s3.txt | AC | 1 ms | 256 KB |