Submission #3346702


Source Code Expand

/**
 * File    : D.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-10-6 21:19:14
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int N, M;
int ans = 1;

int main()
{
  cin >> N >> M;

  for (auto i = 1; i < 100010; i++)
  {
    if (M % i == 0)
    {
      int x[2] = {i, M / i};
      for (auto k = 0; k < 2; k++)
      {
        int g = x[k];
        int n = M / g;
        if (n >= N)
        {
          ans = max(ans, g);
        }
      }
    }
  }
  cout << ans << endl;
}

Submission Info

Submission Time
Task D - Partition
User kazunetakahashi
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1558 Byte
Status AC
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name All Sample
Score / Max Score 400 / 400 0 / 0
Status
AC × 30
AC × 3
Set Name Test Cases
All 0_small_1, 0_small_2, 0_small_3, 1_large_1, 1_large_2, 1_large_3, 1_large_4, 1_large_5, 1_large_6, 1_large_7, 2_max_1, 2_max_2, 3_prime_1, 3_prime_10, 3_prime_11, 3_prime_2, 3_prime_3, 3_prime_4, 3_prime_5, 3_prime_6, 3_prime_7, 3_prime_8, 3_prime_9, 4_hand_1, 4_hand_2, 4_hand_3, 4_hand_4, sample_01, sample_02, sample_03
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
0_small_1 AC 1 ms 256 KB
0_small_2 AC 1 ms 256 KB
0_small_3 AC 1 ms 256 KB
1_large_1 AC 1 ms 256 KB
1_large_2 AC 1 ms 256 KB
1_large_3 AC 2 ms 256 KB
1_large_4 AC 1 ms 256 KB
1_large_5 AC 1 ms 256 KB
1_large_6 AC 1 ms 256 KB
1_large_7 AC 1 ms 256 KB
2_max_1 AC 1 ms 256 KB
2_max_2 AC 2 ms 256 KB
3_prime_1 AC 1 ms 256 KB
3_prime_10 AC 1 ms 256 KB
3_prime_11 AC 1 ms 256 KB
3_prime_2 AC 1 ms 256 KB
3_prime_3 AC 1 ms 256 KB
3_prime_4 AC 2 ms 256 KB
3_prime_5 AC 1 ms 256 KB
3_prime_6 AC 1 ms 256 KB
3_prime_7 AC 2 ms 256 KB
3_prime_8 AC 1 ms 256 KB
3_prime_9 AC 1 ms 256 KB
4_hand_1 AC 1 ms 256 KB
4_hand_2 AC 1 ms 256 KB
4_hand_3 AC 1 ms 256 KB
4_hand_4 AC 1 ms 256 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sample_03 AC 1 ms 256 KB