結果

問題 No.905 Sorted?
ユーザー tailstails
提出日時 2021-12-23 18:56:20
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 762 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 30,720 KB
実行使用メモリ 7,000 KB
最終ジャッジ日時 2023-10-17 20:10:45
合計ジャッジ時間 1,678 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 4 ms
5,856 KB
testcase_09 AC 3 ms
4,876 KB
testcase_10 AC 6 ms
6,492 KB
testcase_11 AC 5 ms
5,560 KB
testcase_12 AC 5 ms
5,644 KB
testcase_13 AC 6 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 3 ms
5,656 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 2 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;

struct{int u,d;}ud[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);
		ud[i].u=a<p?i:ud[i-1].u;
		ud[i].d=a>p?i:ud[i-1].d;
		p=a;
	}
	rd_skip();
	char*wp=wbuf;
	while(*rp){
		rd(l);
		rd(r);
		*wp++=ud[r].u>l^'1';
		*wp++=' ';
		*wp++=ud[r].d>l^'1';
		*wp++='\n';
	}
	
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0