結果

問題 No.909 たぴの配置
ユーザー tailstails
提出日時 2021-12-23 18:05:56
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 8 ms / 3,000 ms
コード長 935 bytes
コンパイル時間 699 ms
コンパイル使用メモリ 31,404 KB
実行使用メモリ 6,964 KB
最終ジャッジ日時 2023-10-17 19:17:31
合計ジャッジ時間 4,978 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 7 ms
6,868 KB
testcase_06 AC 7 ms
6,964 KB
testcase_07 AC 6 ms
6,748 KB
testcase_08 AC 8 ms
6,828 KB
testcase_09 AC 8 ms
6,940 KB
testcase_10 AC 7 ms
6,736 KB
testcase_11 AC 8 ms
6,720 KB
testcase_12 AC 6 ms
6,760 KB
testcase_13 AC 7 ms
6,852 KB
testcase_14 AC 8 ms
6,748 KB
testcase_15 AC 8 ms
6,724 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'f1':
main.c:50:17: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   50 |                 write(1,wbuf,wp-wbuf);
      |                 ^~~~~
main.c:52:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   52 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

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

#define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define WTHI(v) {ulong _z=v,_n=0,_d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(ulong*)wp=_d;wp+=_n;}
#define WTLO(v) {ulong _z=v,_n=8,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(ulong*)wp=_d;wp+=8;}
#define wt(v) WTHI(v)
#define rep(v,e) for(long v=0;v<e;++v)

typedef unsigned long ulong;
char wbuf[1<<25];
int x[200000];

void f1(){
	long d=2000000;
	long n;
	{
		char*mmap();
		char*rp=mmap(0l,1l<<25,1,2,0,0ll);
		{
			rd(v);
			n=v;
		}
		rep(i,n){
			rd(xi);
			x[i]=xi;
		}
		rep(i,n){
			rd(yi);
			long xi=x[i];
			if(d>xi+yi){
				d=xi+yi;
			}
		}
	}
	{
		char*wp=wbuf;
		wt(d);
		*wp++='\n';
		*wp++='0';
		*wp++='\n';
		rep(i,n){
			long xi=x[i];
			long z=xi<d?xi:d;
			wt(z);
			*wp++='\n';
		}
		wt(d);
		*wp++='\n';
		write(1,wbuf,wp-wbuf);
	}
	_exit(0);
}

int main(){
	f1();
	return 0;
}
0