提出 #66082592


ソースコード 拡げる

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

typedef long long ll;
typedef pair<int, int> pii;
constexpr int MAXN = 1'000'007;
constexpr int INF = 2'000'000'000;
constexpr ll INFF = 1'000'000'000'000'000'000LL;
constexpr ll MOD = 998'244'353;
#define mkp make_pair
#define F first
#define S second
#define pb emplace_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int x, y;
  cin >> x >> y;
  int ans = 0;
  for (int i = 1; i <= 6; i++)
    for (int j = 1; j <= 6; j++) {
      if (i + j >= x || abs(i - j) >= y)
        ans++;
    }
  cout << fixed << setprecision(15) << ans * 1.0 / 36 << '\n';
}
/*
- How to come up with solutions? (https://hackmd.io/-3cIVAFSQMC3iJTh9EpszA)
  - Play with some small examples.
  - Make observations (or random guesses) by intuition.
    - Try to find counterexamples of the "observations."
  - Find the characteristics of an optimal solution.
  - Try to solve simple cases.
  - Brute force and print out the results.
  - Pick a method (greedy, dp, d&c, ...)
    - But DO NOT force algos on problems!
  - IF YOU'RE STUCK, TRY SOMETHING ELSE! Make new observations!

- Before writing the solution:
  - check TL/ML/correctness of samples/implementation details!

- Pre-submit:
  - Did you make a typo when copying a template?
  - Test more cases if unsure.
    - Write a naive solution and check small cases.
  - Submit the correct file.

- Debugging:
  - General Debugging:
    - Read the whole problem again.
    - Think over the algorithm again.
    - Go to the toilet.

  - Wrong Answer:
    - Any possible overflows?
      - > `__int128` ?
      - Try `-ftrapv` or `#pragma GCC optimize("trapv")`
    - Floating point errors?
      - > `long double` ?
      - turn off math optimizations
      - check for `==`, `>=`, `acos(1.000000001)`, etc.
    - Did you forget to sort or unique?
    - Generate large and worst "corner" cases.
    - Check your `m` / `n`, `i` / `j`,  `x` / `y` and `<` / `>`.
    - Are everything initialized or reset properly?
    - Are you sure about the STL thing you are using?
      - Read cppreference.
    - Print everything and run it on pen and paper.

  - Time Limit Exceeded:
    - Calculate your time complexity again.
    - Does the program actually end?
      - Check for `while(q.size())` etc.
    - Test the largest cases locally.
    - Did you do unnecessary stuff?
      - e.g. pass vectors by value
      - e.g. `memset` for every test case
    - Is your constant factor reasonable?

  - Runtime Error:
    - Check memory usage.
      - Forget to clear or destroy stuff?
      - > `vector::shrink_to_fit()`
    - Stack overflow?
    - Bad pointer / array access?
      - Try `-fsanitize=address`
    - Division by zero? NaN's?
*/

提出情報

提出日時
問題 B - P(X or Y)
ユーザ henotrix
言語 C++ 20 (gcc 12.2)
得点 250
コード長 2887 Byte
結果 AC
実行時間 1 ms
メモリ 3804 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 250 / 250
結果
AC × 3
AC × 17
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3720 KiB
00_sample_01.txt AC 1 ms 3792 KiB
00_sample_02.txt AC 1 ms 3792 KiB
01_random_03.txt AC 1 ms 3756 KiB
01_random_04.txt AC 1 ms 3744 KiB
01_random_05.txt AC 1 ms 3624 KiB
01_random_06.txt AC 1 ms 3800 KiB
01_random_07.txt AC 1 ms 3776 KiB
01_random_08.txt AC 1 ms 3732 KiB
01_random_09.txt AC 1 ms 3724 KiB
01_random_10.txt AC 1 ms 3760 KiB
01_random_11.txt AC 1 ms 3624 KiB
01_random_12.txt AC 1 ms 3792 KiB
01_random_13.txt AC 1 ms 3752 KiB
01_random_14.txt AC 1 ms 3676 KiB
01_random_15.txt AC 1 ms 3804 KiB
01_random_16.txt AC 1 ms 3788 KiB