Submission #846558


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() {
  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 (ll i = 2; i * i <= 100000; ++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) {
        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
Task D - Anticube
User ir5
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1545 Byte
Status WA
Exec Time 971 ms
Memory 28160 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24: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 0 / 1100
Status
AC × 3
AC × 37
WA × 14
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 956 ms 28160 KB
02.txt AC 964 ms 28160 KB
03.txt AC 964 ms 28160 KB
04.txt AC 961 ms 28160 KB
05.txt AC 966 ms 28160 KB
06.txt AC 961 ms 28160 KB
07.txt AC 962 ms 28160 KB
08.txt AC 971 ms 28160 KB
09.txt AC 968 ms 28160 KB
10.txt AC 962 ms 28160 KB
11.txt AC 717 ms 7040 KB
12.txt AC 718 ms 7040 KB
13.txt WA 729 ms 8320 KB
14.txt WA 724 ms 8320 KB
15.txt WA 720 ms 8320 KB
16.txt WA 720 ms 8320 KB
17.txt AC 785 ms 256 KB
18.txt AC 787 ms 256 KB
19.txt AC 785 ms 256 KB
20.txt AC 789 ms 256 KB
21.txt WA 838 ms 15104 KB
22.txt WA 835 ms 15104 KB
23.txt WA 835 ms 15104 KB
24.txt WA 840 ms 15104 KB
25.txt WA 841 ms 15104 KB
26.txt WA 841 ms 15104 KB
27.txt AC 897 ms 22400 KB
28.txt AC 629 ms 256 KB
29.txt AC 626 ms 256 KB
30.txt AC 687 ms 256 KB
31.txt AC 697 ms 256 KB
32.txt AC 691 ms 256 KB
33.txt AC 4 ms 256 KB
34.txt AC 739 ms 256 KB
35.txt AC 728 ms 256 KB
36.txt AC 4 ms 256 KB
37.txt WA 737 ms 8960 KB
38.txt WA 737 ms 8960 KB
39.txt WA 740 ms 8960 KB
40.txt WA 753 ms 8960 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 AC 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