Submission #60537873


Source Code Expand

Copy
/* -------------------------------------- HEADER FILES ---------------------------------------- */
/**
* username: aditya_0670
* created: 2024-12-07 18:42:56
**/
#include <bits/stdc++.h>
using namespace std;
/* ------------------------------------ MACROS & CONSTANTS ------------------------------------ */
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define debug(...) ;
#endif
#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/* -------------------------------------- HEADER FILES ---------------------------------------- */

/**
 *    username:  aditya_0670
 *    created: 2024-12-07 18:42:56
 **/

  #include <bits/stdc++.h>
  using namespace std;

/* ------------------------------------ MACROS & CONSTANTS ------------------------------------ */

  #ifndef ONLINE_JUDGE
      #include "debug.h"
  #else
      #define debug(...) ;
  #endif

  #define int             long long
  #define all(v)          (v).begin(), (v).end()
  #define rall(v)         (v).rbegin(), (v).rend()
  #define fastio          ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)

  constexpr int MOD = 1E9 + 7;
  constexpr int INF = 1E18;


/* ------------------------------------ OTHER FUNCTIONS ------------------------------------ */


/* ------------------------------------ LAMBDA TEMPLATE ------------------------------------- */

  auto solve = [] -> void
  {
      int N; cin >> N;

      int limit = sqrt(N);
      
      vector<int> primes;

      auto seive =[&]() 
      {
          vector<bool> is_prime(limit + 1, true);
          is_prime[0] = is_prime[1] = false;

          for (int i = 2; i <= limit; ++i) 
          {
              if (is_prime[i]) 
              {
                  primes.push_back(i);
                  for (int j = 2 * i; j <= limit; j += i) 
                      is_prime[j] = false;
              }
          }
          return primes;
      };
      seive();

      auto f1 =[&]() 
      {
          int count = 0;
          for (int p : primes) 
          {
              int val = 1;
              for (int i = 0; i < 8; ++i) 
              {
                  if (val > N / p) {count--; break; }
                  val *= p;
              }
              if (val <= N) count++;
          }


          int sz = primes.size();
          for (int i = 0; i < sz; ++i) 
          {
              int p1_sq = (int)primes[i] * primes[i];
              if (p1_sq > N) break;

              for (int j = i + 1; j < sz; ++j) 
              {
                  int p2_sq = (int)primes[j] * primes[j];
                  if (p1_sq > N / p2_sq) break;

                  int product = p1_sq * p2_sq;
                  if (product <= N) count++;
              }
          }
          return count;
      };

      cout << f1() << '\n';
  };

/* ------------------------------------ MAIN FUNCTION --------------------------------------- */

  signed main() 
  {
      fastio;

      int t = 1;
      while (t--) solve();

      return 0;
  }

Submission Info

Submission Time
Task D - 9 Divisors
User aditya_0670
Language C++ 23 (gcc 12.2)
Score 400
Code Size 2649 Byte
Status AC
Exec Time 16 ms
Memory 5668 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 34
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 3260 KB
00_sample_02.txt AC 16 ms 5616 KB
01_test_01.txt AC 1 ms 3272 KB
01_test_02.txt AC 1 ms 3360 KB
01_test_03.txt AC 1 ms 3320 KB
01_test_04.txt AC 1 ms 3324 KB
01_test_05.txt AC 1 ms 3272 KB
01_test_06.txt AC 9 ms 4552 KB
01_test_07.txt AC 5 ms 3708 KB
01_test_08.txt AC 14 ms 5300 KB
01_test_09.txt AC 15 ms 5480 KB
01_test_10.txt AC 8 ms 4312 KB
01_test_11.txt AC 15 ms 5616 KB
01_test_12.txt AC 8 ms 4468 KB
01_test_13.txt AC 8 ms 4312 KB
01_test_14.txt AC 10 ms 4788 KB
01_test_15.txt AC 15 ms 5480 KB
01_test_16.txt AC 11 ms 4972 KB
01_test_17.txt AC 9 ms 4408 KB
01_test_18.txt AC 8 ms 4292 KB
01_test_19.txt AC 14 ms 5456 KB
01_test_20.txt AC 4 ms 3660 KB
01_test_21.txt AC 1 ms 3364 KB
01_test_22.txt AC 1 ms 3256 KB
01_test_23.txt AC 1 ms 3360 KB
01_test_24.txt AC 15 ms 5480 KB
01_test_25.txt AC 16 ms 5488 KB
01_test_26.txt AC 16 ms 5472 KB
01_test_27.txt AC 15 ms 5472 KB
01_test_28.txt AC 15 ms 5620 KB
01_test_29.txt AC 15 ms 5668 KB
01_test_30.txt AC 15 ms 5464 KB
01_test_31.txt AC 15 ms 5556 KB
01_test_32.txt AC 15 ms 5528 KB


2025-03-05 (Wed)
20:38:44 +00:00