55852023-08-02 12:26:13TomaSajtSakktábla (75 pont)cpp17Wrong answer 35/753ms3876 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;

  if (n > m) swap(n, m);

  auto possible = [&](int k) {
    int k2 = k * k;
    return n >= k2 / 2 && m >= (k2 + 1) / 2;
  };

  

  int sol = -1;
  for (int k = 1; k <= 1001; k++) {
    if (!possible(k)) {
      sol = k - 1;
      break;
    }
  }
  cout << sol;

  

  /*

  int l = 0, r = 1001;
  while (l < r - 1) {
    int m = (l + r) / 2;
    if (possible(m)) {
      l = m;
    }
    else {
      r = m;
    }
  }
  cout << l;

  */

  /*

  int sqrt_2n = sqrt(2 * n);
  int sqrt_2np1 = sqrt(2 * n + 1);
  if (m != n && sqrt_2n % 2 == 0 && sqrt_2np1 % 2 == 1) {
    cout << sqrt_2n + 1;
  }
  else {
    cout << sqrt_2n;
  }

  */
}
SubtaskSumTestVerdictTimeMemory
base35/75
1Accepted0/03ms1876 KiB
2Wrong answer0/03ms2268 KiB
3Accepted5/53ms2404 KiB
4Accepted5/53ms2564 KiB
5Accepted5/53ms2860 KiB
6Accepted5/53ms3104 KiB
7Accepted5/52ms3316 KiB
8Accepted5/52ms3404 KiB
9Accepted5/52ms3312 KiB
10Wrong answer0/52ms3552 KiB
11Wrong answer0/73ms3616 KiB
12Wrong answer0/72ms3784 KiB
13Wrong answer0/72ms3752 KiB
14Wrong answer0/72ms3864 KiB
15Wrong answer0/73ms3876 KiB