結果
| 問題 | 
                            No.5009 Draw A Convex Polygon
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-12-02 02:04:25 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 934 ms / 2,600 ms | 
| コード長 | 966 bytes | 
| コンパイル時間 | 1,937 ms | 
| 実行使用メモリ | 27,236 KB | 
| スコア | 1,000,000 | 
| 平均クエリ数 | 952382.00 | 
| 最終ジャッジ日時 | 2022-12-02 02:04:44 | 
| 合計ジャッジ時間 | 4,565 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge12 / judge11 | 
| 純コード判定しない問題か言語 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 1 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int y = -1000000000, x = 1000000000;
    vector<pair<int,int>> pos;
    for(int i = 1; i <= 2000 && pos.size() < 1000000; i++){
        for(int j = 1; j < i && pos.size() < 1000000; j++){
            if(__gcd(j, i) != 1)continue;
            for(int k = j; k <= 1000 && pos.size() < 1000000; k += i){
                pos.emplace_back(-i, k);
            }
        }
    }
    sort(pos.begin(), pos.end(), [&](pair<int,int> lhs, pair<int,int> rhs){
        return (ll)(lhs.first) * rhs.second > (ll)(lhs.second) * rhs.first;
    });
    cout << pos.size() << '\n';
    for(int i = 0; i < pos.size(); i++){
        x += pos[i].first, y += pos[i].second;
        assert(-1000000000 <= x && x <= 1000000000);
        assert(-1000000000 <= y && y <= 1000000000);
        cout << x << " " << y << '\n';
    }
    //cerr << "ok" << '\n';
}