結果

問題 No.905 Sorted?
ユーザー tailstails
提出日時 2021-12-23 18:55:10
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 741 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 31,180 KB
実行使用メモリ 7,000 KB
最終ジャッジ日時 2023-10-17 20:09:40
合計ジャッジ時間 3,158 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 4 ms
5,860 KB
testcase_09 AC 3 ms
4,880 KB
testcase_10 AC 5 ms
6,472 KB
testcase_11 AC 4 ms
5,536 KB
testcase_12 AC 5 ms
5,648 KB
testcase_13 AC 5 ms
6,988 KB
testcase_14 AC 5 ms
7,000 KB
testcase_15 AC 4 ms
5,420 KB
testcase_16 AC 4 ms
6,020 KB
testcase_17 AC 4 ms
6,008 KB
testcase_18 AC 4 ms
5,656 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:41:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   41 |         write(1,wbuf,wp-wbuf);
      |         ^~~~~
main.c:42:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   42 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

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

#define rd_skip() while(*rp++>=48)
#define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define rd_signed(v) long v=0;{long _c,_s;_s=*rp=='-'&&++rp;while(_c=*rp++-48,_c>=0)v=v*10+_c;v=_s?-v:v;}
#define rep3(v,s,e) for(long v=s;v<e;++v)

char*mmap();
char wbuf[1<<25];

typedef unsigned long ulong;

int u[100000],d[100000];

int main(){
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	rd(n);
	long p;
	{
		rd_signed(a);
		p=a;
	}
	rep3(i,1,n){
		rd_signed(a);
		u[i]=a<p?i:u[i-1];
		d[i]=a>p?i:d[i-1];
		p=a;
	}
	rd_skip();
	char*wp=wbuf;
	while(*rp){
		rd(l);
		rd(r);
		*wp++=u[r]>l^'1';
		*wp++=' ';
		*wp++=d[r]>l^'1';
		*wp++='\n';
	}
	
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0