結果

問題 No.2652 [Cherry 6th Tune N] Δρονε χιρχλινγ
ユーザー Nzt3Nzt3
提出日時 2024-02-25 18:11:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 899 bytes
コンパイル時間 3,363 ms
コンパイル使用メモリ 215,784 KB
実行使用メモリ 8,852 KB
最終ジャッジ日時 2024-02-25 18:11:41
合計ジャッジ時間 28,682 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 96 ms
6,676 KB
testcase_02 AC 95 ms
6,676 KB
testcase_03 AC 96 ms
6,676 KB
testcase_04 AC 100 ms
6,676 KB
testcase_05 AC 100 ms
6,676 KB
testcase_06 AC 101 ms
6,676 KB
testcase_07 AC 107 ms
6,676 KB
testcase_08 AC 106 ms
6,676 KB
testcase_09 AC 108 ms
6,984 KB
testcase_10 AC 106 ms
6,688 KB
testcase_11 AC 108 ms
6,676 KB
testcase_12 AC 105 ms
6,676 KB
testcase_13 AC 109 ms
8,164 KB
testcase_14 AC 110 ms
8,784 KB
testcase_15 AC 108 ms
7,340 KB
testcase_16 AC 106 ms
6,676 KB
testcase_17 AC 108 ms
7,180 KB
testcase_18 AC 109 ms
6,844 KB
testcase_19 AC 109 ms
7,948 KB
testcase_20 AC 112 ms
8,852 KB
testcase_21 AC 112 ms
8,848 KB
testcase_22 AC 112 ms
8,848 KB
testcase_23 AC 112 ms
8,848 KB
testcase_24 AC 112 ms
8,852 KB
testcase_25 AC 112 ms
8,852 KB
testcase_26 AC 113 ms
8,848 KB
testcase_27 AC 112 ms
8,848 KB
testcase_28 AC 112 ms
8,848 KB
testcase_29 AC 112 ms
8,848 KB
testcase_30 AC 113 ms
8,848 KB
testcase_31 AC 112 ms
8,848 KB
testcase_32 AC 112 ms
8,848 KB
testcase_33 AC 113 ms
8,848 KB
testcase_34 AC 112 ms
8,852 KB
testcase_35 AC 112 ms
8,852 KB
testcase_36 AC 136 ms
8,852 KB
testcase_37 AC 113 ms
8,848 KB
testcase_38 AC 113 ms
8,852 KB
testcase_39 AC 112 ms
8,852 KB
testcase_40 AC 94 ms
8,620 KB
testcase_41 AC 86 ms
8,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
void solve();
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int test_case;
  cin>>test_case;
  while (test_case--){
    solve();
  }
}
void solve(){
  int N,L;
  cin>>N>>L;
  vector P(N,array<int,2>());
  for(auto &i:P)cin>>i[0]>>i[1];
  sort(P.begin(),P.end());
  int sqN=sqrt(N)+1,sqL=L/sqN;
  vector dP(sqN+1,vector(0,array<int,2>()));
  for(int i=0;i<N;i++){
    dP[P[i][0]/sqL].push_back(P[i]);
  }
  for(auto &i:dP){
    sort(i.begin(),i.end(),[](array<int,2> a,array<int,2> b){
      return a[1]<b[1];
    });
  }
  vector ans(0,array<int,2>());
  for(int i=0;i<(int)dP.size();i++){
    if(i%2){
      reverse(dP[i].begin(),dP[i].end());
    }
    for(auto j:dP[i]){
      ans.push_back(j);
    }
  }
  cout<<ans.size()<<'\n';
  for(auto i:ans)cout<<i[0]<<' '<<i[1]<<'\n';
}
0