結果

問題 No.601 Midpoint Erase
ユーザー exteloextelo
提出日時 2017-12-15 14:35:52
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,093 bytes
コンパイル時間 692 ms
コンパイル使用メモリ 32,100 KB
実行使用メモリ 4,448 KB
最終ジャッジ日時 2023-08-24 18:50:22
合計ジャッジ時間 1,703 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 17 ms
4,384 KB
testcase_04 AC 19 ms
4,380 KB
testcase_05 AC 14 ms
4,384 KB
testcase_06 AC 8 ms
4,384 KB
testcase_07 AC 19 ms
4,384 KB
testcase_08 AC 17 ms
4,380 KB
testcase_09 AC 19 ms
4,384 KB
testcase_10 AC 5 ms
4,384 KB
testcase_11 AC 27 ms
4,448 KB
testcase_12 AC 12 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,384 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,384 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

typedef long long int lli;

class Point
{
public:
  lli x;
  lli y;
};

int divide(Point *point, lli num)
{
  lli even_even = 0;
  lli even_odd = 0;
  lli odd_even= 0;
  lli odd_odd = 0;

  for (int i=0; i<num; i++) {
    if (point[i].x % 2 == 0 && point[i].y % 2 == 0) {
      even_even++;
    } 
    if (point[i].x % 2 == 0 && point[i].y % 2 != 0) {
      even_odd++;
    }
    if (point[i].x % 2 != 0 && point[i].y % 2 == 0) {
      odd_even++;
    }
    if (point[i].x % 2 !=0 && point[i].y % 2 != 0) {
      odd_odd++;
    }
  }
// %4 ==0||1 winner is Bob, else Alice 
  lli judge = ((even_even / 2) + (even_odd / 2) + (odd_even / 2) + (odd_odd / 2)) % 2;
  
  return judge;
}


int main(void)
{
  lli num;
  scanf("%lld", &num);

  Point *point;
  point = new Point[num];

  for (int i=0; i<num; i++) {
    scanf("%lld %lld", &point[i].x, &point[i].y);
  //  printf("%lld %lld\n", point[i].x, point[i].y);
  }

  int winner;
  winner = divide(point, num);

  if (winner == 0) {
    printf("Bob\n");
  }
  if (winner == 1) {
    printf("Alice\n");
  }

  return 0;
}

0