結果
問題 |
No.2797 Square Tile
|
ユーザー |
👑 ![]() |
提出日時 | 2024-06-19 04:36:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 2,132 ms |
コンパイル使用メモリ | 198,372 KB |
最終ジャッジ日時 | 2025-02-21 23:17:20 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 WA * 8 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int A, B; cin >> A >> B; vector<pair<int, int>> X, Y; bool rev = 0; if (A > B) swap(A, B), rev = 1; int P = 0, Q = 0; int L = A * A + B * B; vector<int> seen(L); while (seen[P] == 0){ while (seen[P] == 0){ seen[P] = 1; X.push_back({P, Q}); Y.push_back({(P + A) % L, Q}); P = (P + L - B) % L; Q = (Q + A) % L; } P = (P + A) % L; Q = (Q + B) % L; } if (rev) swap(X, Y); for (auto x : X) cout << x.first << " " << x.second << "\n"; for (auto y : Y) cout << y.first << " " << y.second << "\n"; }