結果
問題 |
No.2597 Yet Another Topological Problem
|
ユーザー |
|
提出日時 | 2023-12-25 08:24:09 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 247 ms / 2,000 ms |
コード長 | 962 bytes |
コンパイル時間 | 958 ms |
コンパイル使用メモリ | 79,188 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-27 14:14:41 |
合計ジャッジ時間 | 3,393 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
#include <iostream> using namespace std; int main() { int p, q; cin >> p >> q; if (p == 1) { cout << "Impossible" << endl; return 0; } cout << "Possible" << endl; int k = q / p; cout << 3 * k * (k + 1) << endl; int x = 0, y = 0; cout << x << " " << y << endl; for (int i = 0; i < k; i++) { for (int j = 0; j < k - i; j++) { cout << x << " " << --y << endl; } for (int j = 0; j < k - i; j++) { cout << ++x << " " << y << endl; } for (int j = 0; j < k - i; j++) { cout << x << " " << ++y << endl; } for (int j = 0; j < i + 1; j++) { cout << x << " " << ++y << endl; } for (int j = 0; j < i + 1; j++) { cout << ++x << " " << y << endl; } for (int j = 0; j < i + 1; j++) { cout << x << " " << --y << endl; } } return 0; }