結果
問題 | No.2843 Birthday Present Struggle |
ユーザー |
![]() |
提出日時 | 2024-08-23 21:33:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 1,982 ms |
コンパイル使用メモリ | 197,528 KB |
最終ジャッジ日時 | 2025-02-23 23:32:51 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; int ax, ay, bx, by, cx, cy; cin >> ax >> ay >> bx >> by >> cx >> cy; vector<pair<int, int>> ans; int dx[] = {-1, 1, 0, 0}; int dy[] = {0, 0, -1, 1}; for (int d = 0; d < 4; d++) { int x = cx + dx[d]; int y = cy + dy[d]; if (x >= 1 && x <= n && y >= 1 && y <= n) { ans.push_back({x, y}); } } cout << ans.size() << '\n'; for (auto [x, y] : ans) { cout << x << ' ' << y << '\n'; } }