結果

問題 No.2843 Birthday Present Struggle
ユーザー C++ C++
提出日時 2024-08-23 22:17:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 53,876 KB
最終ジャッジ日時 2024-08-23 22:17:16
合計ジャッジ時間 3,823 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

import os, sys
if os.path.exists("input.txt"):
  sys.stdin = open('input.txt', 'r')

N = int(input())
Ax, Ay = map(int, input().split())
Bx, By = map(int, input().split())
Cx, Cy = map(int, input().split())

def is_ok(i, j):
  return i > 0 and i <= N and j > 0 and j <= N

walls = []
dirs = [0, 1, 0, -1, 0]
for k in range(4):
  nx, ny = dirs[k] + Cx, dirs[k + 1] + Cy
  if is_ok(nx, ny):
    walls.append([nx, ny])

print(len(walls))
for wall in walls:
  print(*wall)
0