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