結果

問題 No.702 中央値を求めよ LIMITED
コンテスト
ユーザー ciel
提出日時 2018-06-17 22:46:34
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
RE  
実行時間 -
コード長 443 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 62 ms
コンパイル使用メモリ 37,504 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2026-07-21 21:33:45
合計ジャッジ時間 9,774 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:20:21: warning: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   20 |         qsort(a,n,4,"\x8b\7+\6\xc3");
      |                     ^~~~~~~~~~~~~~~
      |                     |
      |                     char *
In file included from main.c:2:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'char *'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
/usr/include/stdlib.h:948:15: note: '__compar_fn_t' declared here
  948 | typedef int (*__compar_fn_t) (const void *, const void *);
      |               ^~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include <stdio.h>
#include <stdlib.h>
unsigned int x=0,y=1,z=2,w=3,a[6000000];
unsigned int generate(){
	unsigned int t = (x^(x<<11));
	x = y;
	y = z;
	z = w;
	w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
	return w;
}
int main(){
	unsigned int i=0,n=0,m=0;
	scanf("%u",&x);
	for(;i<10000001;i++){
		unsigned int k=generate();
		if(k<1U<<30)m++;
		else if(k<(1U<<31|1U<<30))a[n++]=k;
	}
	qsort(a,n,4,"\x8b\7+\6\xc3");
	printf("%u\n",a[5000000-m]);
}
0