結果

問題 No.2652 [Cherry 6th Tune N] Δρονε χιρχλινγ
ユーザー otoshigootoshigo
提出日時 2024-02-23 23:23:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 1,354 bytes
コンパイル時間 1,245 ms
コンパイル使用メモリ 103,696 KB
実行使用メモリ 16,528 KB
最終ジャッジ日時 2024-02-23 23:24:10
合計ジャッジ時間 25,745 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 106 ms
6,676 KB
testcase_02 AC 106 ms
6,676 KB
testcase_03 AC 109 ms
6,676 KB
testcase_04 AC 103 ms
6,676 KB
testcase_05 AC 105 ms
6,676 KB
testcase_06 AC 103 ms
6,676 KB
testcase_07 AC 109 ms
8,940 KB
testcase_08 AC 111 ms
8,704 KB
testcase_09 AC 113 ms
10,028 KB
testcase_10 AC 111 ms
8,904 KB
testcase_11 AC 120 ms
8,576 KB
testcase_12 AC 113 ms
9,704 KB
testcase_13 AC 119 ms
12,728 KB
testcase_14 AC 136 ms
16,208 KB
testcase_15 AC 117 ms
12,060 KB
testcase_16 AC 129 ms
9,728 KB
testcase_17 AC 117 ms
10,972 KB
testcase_18 AC 114 ms
11,392 KB
testcase_19 AC 113 ms
12,472 KB
testcase_20 AC 124 ms
16,520 KB
testcase_21 AC 120 ms
16,528 KB
testcase_22 AC 124 ms
16,520 KB
testcase_23 AC 120 ms
16,528 KB
testcase_24 AC 122 ms
16,524 KB
testcase_25 AC 120 ms
16,524 KB
testcase_26 AC 124 ms
16,524 KB
testcase_27 AC 123 ms
16,524 KB
testcase_28 AC 120 ms
16,524 KB
testcase_29 AC 119 ms
16,520 KB
testcase_30 AC 122 ms
16,524 KB
testcase_31 AC 121 ms
16,528 KB
testcase_32 AC 127 ms
16,528 KB
testcase_33 AC 122 ms
16,520 KB
testcase_34 AC 121 ms
16,520 KB
testcase_35 AC 120 ms
16,528 KB
testcase_36 AC 121 ms
16,520 KB
testcase_37 AC 124 ms
16,524 KB
testcase_38 AC 122 ms
16,516 KB
testcase_39 AC 142 ms
16,524 KB
testcase_40 AC 90 ms
14,104 KB
testcase_41 AC 89 ms
14,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T;
    cin>>T;
    while(T--){
        int N;
        ll L;
        cin>>N>>L;
        vector<ll>X(N),Y(N);
        for(int i=0;i<N;i++)cin>>X[i]>>Y[i];
        int sq=sqrt(N),ma=L/(L/sq);
        vector V(ma+1,vector<vector<pair<int,int>>>(ma+1));
        for(int i=0;i<N;i++){
            V[X[i]/(L/sq)][Y[i]/(L/sq)].push_back(make_pair(X[i],i));
        }
        vector<int>ans;
        for(int i=0;i<=ma;i++){
            if(i%2==0){
                for(int j=0;j<=ma;j++){
                    sort(all(V[i][j]));
                    for(auto[x,k]:V[i][j])ans.push_back(k);
                }
            }else{
                for(int j=ma;j>=0;j--){
                    sort(all(V[i][j]));
                    for(auto[x,k]:V[i][j])ans.push_back(k);
                }
            }
        }
        cout<<ans.size()<<"\n";
        for(auto a:ans){
            cout<<X[a]<<" "<<Y[a]<<"\n";
        }
    }
}
0