結果

問題 No.2843 Birthday Present Struggle
コンテスト
ユーザー ripity
提出日時 2024-08-23 21:18:45
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 479 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,075 ms
コンパイル使用メモリ 217,200 KB
実行使用メモリ 16,384 KB
最終ジャッジ日時 2026-07-05 12:05:52
合計ジャッジ時間 3,346 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main() {
  int N;
  int cx, cy;
  cin >> N >> cx >> cy >> cx >> cy >> cx >> cy;
  vector<pair<int, int>> ans;
  if(cx - 1 >= 1) ans.push_back(make_pair(cx - 1, cy));
  if(cx + 1 <= N) ans.push_back(make_pair(cx + 1, cy));
  if(cy - 1 >= 1) ans.push_back(make_pair(cx, cy - 1));
  if(cy + 1 <= N) ans.push_back(make_pair(cx, cy + 1));
  cout << ans.size() << endl;
  for(const auto &[x, y] : ans) cout << x << " " << y << endl;
}
0