提出 #47233310


ソースコード 拡げる

#include <iostream>
#include <vector>
#include <map>
#include <tuple>

using namespace std;

int main()
{
  vector<int> base(9, 0);
  vector<vector<int>> grid(9, base);

  for (auto &r : grid)
  {
    for (auto &v : r)
    {
      cin >> v;
    }
  }

  // row
  for (unsigned int i = 0; i < 9; i++)
  {
    map<int, bool> nums;
    for (unsigned int j = 0; j < 9; j++)
    {
      if (nums.count(grid[i][j]) != 0)
      {
        cout << "No" << endl;
        return 0;
      }

      nums[grid[i][j]] = true;
    }
  }

  // column
  for (unsigned int j = 0; j < 9; j++)
  {
    map<int, bool> nums;
    for (unsigned int i = 0; i < 9; i++)
    {
      if (nums.count(grid[i][j]) != 0)
      {
        cout << "No" << endl;
        return 0;
      }

      nums[grid[i][j]] = true;
    }
  }

  // area
  for (unsigned int i = 0; i < 9; i += 3)
  {
    for (unsigned int j = 0; j < 9; j += 3)
    {
      map<int, bool> nums;
      for (unsigned int ii = 0; ii < 3; ii++)
      {
        for (unsigned int jj = 0; jj < 3; jj++)
        {
          if (nums.count(grid[i + ii][j + jj]) != 0)
          {
            cout << "No" << endl;
            return 0;
          }

          nums[grid[i + ii][j + jj]] = true;
        }
      }
    }
  }

  cout << "Yes" << endl;
}

提出情報

提出日時
問題 C - Number Place
ユーザ michimani
言語 C++ 20 (Clang 16.0.6)
得点 250
コード長 1349 Byte
結果 AC
実行時間 1 ms
メモリ 3652 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 250 / 250
結果
AC × 3
AC × 31
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3496 KiB
example_01.txt AC 1 ms 3500 KiB
example_02.txt AC 1 ms 3472 KiB
hand_00.txt AC 1 ms 3652 KiB
hand_01.txt AC 1 ms 3424 KiB
hand_02.txt AC 1 ms 3484 KiB
random_00.txt AC 1 ms 3476 KiB
random_01.txt AC 1 ms 3488 KiB
random_02.txt AC 1 ms 3508 KiB
random_03.txt AC 1 ms 3544 KiB
random_04.txt AC 1 ms 3408 KiB
random_05.txt AC 1 ms 3496 KiB
random_06.txt AC 1 ms 3488 KiB
random_07.txt AC 1 ms 3576 KiB
random_08.txt AC 1 ms 3568 KiB
random_09.txt AC 1 ms 3576 KiB
random_10.txt AC 1 ms 3572 KiB
random_11.txt AC 1 ms 3576 KiB
random_12.txt AC 1 ms 3448 KiB
random_13.txt AC 1 ms 3588 KiB
random_14.txt AC 1 ms 3448 KiB
random_15.txt AC 1 ms 3408 KiB
random_16.txt AC 1 ms 3492 KiB
random_17.txt AC 1 ms 3476 KiB
random_18.txt AC 1 ms 3652 KiB
random_19.txt AC 1 ms 3420 KiB
random_20.txt AC 1 ms 3476 KiB
random_21.txt AC 1 ms 3412 KiB
random_22.txt AC 1 ms 3644 KiB
random_23.txt AC 1 ms 3528 KiB
random_24.txt AC 1 ms 3544 KiB