結果

問題 No.2652 [Cherry 6th Tune N] Δρονε χιρχλινγ
ユーザー chro_96chro_96
提出日時 2024-02-25 20:02:26
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 959 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 30,464 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-09-29 11:10:14
合計ジャッジ時間 27,541 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int cmp_int_2d (const void *a, const void *b) {
  int *a_ = (int *)a;
  int *b_ = (int *)b;
  
  if (a_[0] < b_[0]) {
    return -1;
  }
  
  if (a_[0] > b_[0]) {
    return 1;
  }
  
  if (a_[1] < b_[1]) {
    return -1;
  }
  
  if (a_[1] > b_[1]) {
    return 1;
  }
  
  return 0;
}

int main () {
  int t = 0;
  int n = 0;
  int l = 0;
  int xy[200000][3] = {};
  
  int res = 0;
  
  res = scanf("%d", &t);
  while (t > 0) {
    int b = 1;
    res = scanf("%d", &n);
    res = scanf("%d", &l);
    for (int i = 0; i < n; i++) {
      res = scanf("%d", xy[i]);
      res = scanf("%d", xy[i]+1);
    }
    while (b*b < n) {
      b++;
    }
    for (int i = 0; i < n; i++) {
      xy[i][2] = xy[i][0];
      xy[i][0] /= 1+l/b;
    }
    qsort(xy, n, sizeof(int)*3, cmp_int_2d);
    printf("%d\n", n);
    for (int i = 0; i < n; i++) {
      printf("%d %d\n", xy[i][2], xy[i][1]);
    }
    t--;
  }
  
  return 0;
}
0