結果

問題 No.2999 Long Long Friedrice
コンテスト
ユーザー 👑 tails
提出日時 2024-12-24 11:42:25
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,131 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 87 ms
コンパイル使用メモリ 26,676 KB
最終ジャッジ日時 2026-02-24 01:21:43
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'sort_aux':
main.c:18:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   18 |         for(int i=0;i<256;++i){
      |         ^~~
main.c:18:9: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
main.c:21:17: error: redefinition of 'i'
   21 |         for(int i=0;i<n;++i){
      |                 ^
main.c:18:17: note: previous definition of 'i' with type 'int'
   18 |         for(int i=0;i<256;++i){
      |                 ^
main.c:21:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   21 |         for(int i=0;i<n;++i){
      |         ^~~
main.c:25:17: error: redefinition of 'i'
   25 |         for(int i=0;i<256;++i){
      |                 ^
main.c:21:17: note: previous definition of 'i' with type 'int'
   21 |         for(int i=0;i<n;++i){
      |                 ^
main.c:25:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   25 |         for(int i=0;i<256;++i){
      |         ^~~
main.c:30:17: error: redefinition of 'i'
   30 |         for(int i=0;i<n;++i){
      |                 ^
main.c:25:17: note: previous definition of 'i' with type 'int'
   25 |         for(int i=0;i<256;++i){
      |                 ^
main.c:30:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   30 |         for(int i=0;i<n;++i){
      |         ^~~
main.c: In function 'main':
main.c:38:13: error: expected ';' before 'i'
   38 |         rep(i,n){
      |             ^
main.c:8:31: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
      |                               ^
main.c:38:13: error: 'i' undeclared (first use in this function)
   38 |         rep(i,n){
      |             ^
main.c:8:35: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
      |                                   ^
main.c:38:13: note: each undeclared identifier is reported

ソースコード

diff #
raw source code

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) ({unsigned _z=v;do*--wp=_z%10+48;while(_z/=10);})
#define wt1(v) ({char wbuf[64],*wp=wbuf+sizeof wbuf;wt(v);write(1,wp,wbuf+sizeof wbuf-wp);})
#define rep(v,e) for(typeof(e)v=0;v<e;++v)
#define chmax(v,a) (v=v>=a?v:a)

typedef unsigned long ulong;

ulong ab[2000];
char c[1000001];

void sort_aux(ulong*a,ulong*b,int n){
	int c[256];
	for(int i=0;i<256;++i){
		c[i]=0;
	}
	for(int i=0;i<n;++i){
		++c[a[i]&255];
	}
	int t=0;
	for(int i=0;i<256;++i){
		int u=c[i];
		c[i]=t;
		t+=u;
	}
	for(int i=0;i<n;++i){
		b[c[a[i]&255]++]=a[i]>>8|a[i]<<56;
	}
}

int main(){
	rd_init();
	int n=rd();
	rep(i,n){
		ab[i]=rd();
	}
	rep(i,n){
		ab[i]|=(ulong)(ab[i]+rd())<<32;
	}
	{
		ulong buf[2000];
		sort_aux(ab,buf,n);
		sort_aux(buf,ab,n);
		sort_aux(ab,buf,n);
		sort_aux(buf,ab,n);
	}
	unsigned z=1;
	c[1]=1;
	rep(i,n){
		ulong a=ab[i]>>32;
		if(c[a]){
			unsigned d=ab[i];
			c[d]=1;
			chmax(z,d);
		}
	}
	wt1(z);
	_exit(0);
}
0