Submission #1512233


Source Code Expand

#include<bits/stdc++.h>
#define ll long long
#define N 100005
using namespace std;

int n,ans,flag;
ll x;
map<ll,int> mp;
map<ll,ll> ant;

int main() {

  scanf("%d",&n);
  for(int i=1;i<=n;i++) {
    scanf("%lld",&x);
    ll fx=x;
    ll nnum=1,anti=1;
    for(ll j=2;j*j*j<=x;j++) {
      int num=0;
      while(fx%j==0) num++,fx/=j;
      num%=3;
      if(num) {
        for(int k=1;k<=num;k++,nnum*=j);
        for(int k=1;k<=3-num;k++,anti*=j);
      }
    }
    nnum*=fx;
    if(fx<=N && anti*fx<=N*N && anti*fx*fx<=N*N) {
      anti*=fx*fx;
    }
    else {
      ans+=2;
      continue ;
    }
    if(nnum==1) {
      flag=1;
      continue ;
    }
    mp[nnum]++;
    ant[nnum]=anti;
  }
  for(auto i:mp) {
    if(mp[ant[i.first]]) {
      ans+=max(i.second,mp[ant[i.first]]);
    }
    else {
      ans+=2*i.second;
    }
  }
  printf("%d",ans/2+flag);

}

Submission Info

Submission Time
Task D - Anticube
User hamzqq9
Language C++14 (GCC 5.4.1)
Score 0
Code Size 918 Byte
Status WA
Exec Time 2361 ms
Memory 11392 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:28:27: warning: integer overflow in expression [-Woverflow]
     if(fx<=N && anti*fx<=N*N && anti*fx*fx<=N*N) {
                           ^
./Main.cpp:28:46: warning: integer overflow in expression [-Woverflow]
     if(fx<=N && anti*fx<=N*N && anti*fx*fx<=N*N) {
                                              ^
./Main.cpp:13:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
                 ^
./Main.cpp:15:21: 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 0 / 1100
Status
AC × 3
AC × 33
WA × 18
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 1753 ms 384 KB
02.txt AC 1753 ms 384 KB
03.txt AC 1751 ms 384 KB
04.txt AC 1752 ms 384 KB
05.txt AC 1751 ms 384 KB
06.txt AC 1752 ms 384 KB
07.txt AC 1752 ms 384 KB
08.txt AC 1752 ms 384 KB
09.txt AC 1752 ms 384 KB
10.txt AC 1750 ms 384 KB
11.txt AC 1717 ms 256 KB
12.txt AC 1718 ms 256 KB
13.txt WA 256 ms 1024 KB
14.txt WA 258 ms 1024 KB
15.txt WA 260 ms 1024 KB
16.txt WA 260 ms 1024 KB
17.txt AC 825 ms 256 KB
18.txt WA 825 ms 256 KB
19.txt AC 826 ms 256 KB
20.txt AC 823 ms 256 KB
21.txt WA 1144 ms 640 KB
22.txt WA 1140 ms 640 KB
23.txt WA 1142 ms 640 KB
24.txt WA 1141 ms 640 KB
25.txt WA 1145 ms 640 KB
26.txt WA 1142 ms 640 KB
27.txt WA 123 ms 11392 KB
28.txt AC 8 ms 256 KB
29.txt AC 16 ms 256 KB
30.txt AC 12 ms 256 KB
31.txt WA 13 ms 256 KB
32.txt WA 13 ms 256 KB
33.txt AC 1 ms 256 KB
34.txt AC 2361 ms 256 KB
35.txt AC 1122 ms 256 KB
36.txt AC 1 ms 256 KB
37.txt WA 1622 ms 384 KB
38.txt WA 1621 ms 256 KB
39.txt WA 1619 ms 384 KB
40.txt WA 1624 ms 384 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