結果

問題 No.2797 Square Tile
ユーザー ococonomy1ococonomy1
提出日時 2024-06-28 22:20:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,309 bytes
コンパイル時間 2,211 ms
コンパイル使用メモリ 204,284 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 22:20:21
合計ジャッジ時間 3,430 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pli = pair<ll,int>;
#define TEST cerr << "TEST" << endl
#define AMARI 998244353
//#define AMARI 1000000007
#define el '\n'
#define El '\n'

#define MULTI_TEST_CASE false
void solve(void){
    //問題を見たらまず「この問題設定から言えること」をいっぱい言う
    //一個回答に繋がりそうな解法が見えても、実装や細かい詰めに時間がかかりそうなら別の方針を考えてみる
    //添え字回りで面倒になりそうなときは楽になる言い換えを実装の前にじっくり考える
    //ある程度考察しても全然取っ掛かりが見えないときは実験をしてみる
    //よりシンプルな問題に言い換えられたら、言い換えた先の問題を自然言語ではっきりと書く
    int a,b;
    cin >> a >> b;
    int m = a * a + b * b;
    if(a == b){
        int x = 0,y = 0;
        for(int i = 0; i < 2 * m; i++){
            cout << x << ' ' << y << el;
            x += a;
            if(x >= m){
                x = 0;
                y += a;
            }
        }
        return;
    }
    bool sp = false;
    if(a < b){
        swap(a,b);
        sp = true;
    }
    
    
    vector<pii> ansa(m),ansb(m);
    ansa[0] = pair(0,0);
    ansb[0] = pair(a - b,a);
    for(int i = 1; i < m; i++){
        ansa[i] = pair((ansa[i - 1].first + (a - b)) % m,(ansa[i - 1].second + (a + b)) % m);
        ansb[i] = pair((ansb[i - 1].first + (a - b)) % m,(ansb[i - 1].second + (a + b)) % m);
        if(a % 2 == b % 2 && ansa[i].first == 0){
            ansa[i].first += m / 2;
            ansb[i].first += m / 2;
        }
    }
    if(sp){
        swap(ansa,ansb);
    }
    for(int i = 0; i < m; i++)cout << ansa[i].first << ' ' << ansa[i].second << el;
    for(int i = 0; i < m; i++)cout << ansb[i].first << ' ' << ansb[i].second << el;
    return;
}

void calc(void){
    return;
}

signed main(void){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    calc();
    int t = 1;
    if(MULTI_TEST_CASE)cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
0