結果
| 問題 |
No.2797 Square Tile
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-28 23:00:12 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 2,000 ms |
| コード長 | 976 bytes |
| コンパイル時間 | 5,564 ms |
| コンパイル使用メモリ | 314,308 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 23:00:19 |
| 合計ジャッジ時間 | 7,228 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define all(a) (a).begin(), (a).end()
bool chmin(auto &a, auto b){if(a > b){a = b; return true;} return false;}
bool chmax(auto &a, auto b){if(a < b){a = b; return true;} return false;}
int main(){
int a,b;
cin >> a >> b;
vector<array<int,2>> ans;
int mod = a * a + b * b;
array<int,2> nw = {0,0};
set<array<int,2>> st;
rep(i,0,(a*a+b*b)){
ans.push_back(nw);
st.insert(nw);
nw[0] += a;
nw[1] += b;
nw[0] %= mod;
nw[1] %= mod;
if(st.count(nw)){
nw[0] = (mod + nw[0] - b) % mod;
nw[1] = (nw[1] + a) % mod;
}
}
rep(i,0,(ans.size())){
cout << ans[i][0] << " " << ans[i][1] << endl;
}
rep(i,0,(ans.size())){
cout << (ans[i][0]+a)%mod << " " << ans[i][1] << endl;
}
}