結果

問題 No.2797 Square Tile
ユーザー Jeroen Op de BeekJeroen Op de Beek
提出日時 2024-06-28 22:22:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 1,490 bytes
コンパイル時間 2,191 ms
コンパイル使用メモリ 201,184 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 22:22:34
合計ジャッジ時間 3,089 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 8 ms
5,376 KB
testcase_05 AC 6 ms
5,376 KB
testcase_06 AC 4 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 5 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 4 ms
5,376 KB
testcase_21 AC 4 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define all(x) x.begin(),x.end()
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << " " << p.second; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; }
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#define ASSERT(...) 42
#endif
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pi;
const int oo = 1e9;
// #include "geodeb.h"
int main() {
    // GD_INIT("c.html");
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b; cin >> a >> b;

    int g = gcd(a,b);
    a/=g,b/=g;
    int L = a*a+b*b;

    
        auto fill = [&](int i, int j, int l) {
            int x=i*g, y = j*g;
            cout << x << ' ' << y << '\n';
            // GD_RECT(x,y,x+l*g,y+l*g,string("black:")+(l==a?"red":"green"));
        };
    // if(a<b) {
        for(int o=0;o<g;++o) for(int r=0;r<g;++r) {
            for(int i=0;i<L;i++) {

                fill((ll(i)*a)%L+o*L,(ll(i)*b)%L+L*r,a);
            }

        }
        for(int o=0;o<g;++o) for(int r=0;r<g;++r) {
            for(int i=0;i<L;i++) {
                fill((ll(i+1)*a)%L+o*L,(ll(i)*b)%L+r*L,b);
            }                
        }



}
0