結果

問題 No.245 貫け!
ユーザー tailstails
提出日時 2023-03-08 15:14:16
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 1,072 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 29,204 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 05:55:51
合計ジャッジ時間 1,785 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 0 ms
4,348 KB
testcase_04 AC 0 ms
4,348 KB
testcase_05 AC 0 ms
4,348 KB
testcase_06 AC 0 ms
4,348 KB
testcase_07 AC 0 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 3 ms
4,348 KB
testcase_13 AC 3 ms
4,348 KB
testcase_14 AC 4 ms
4,348 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 AC 3 ms
4,348 KB
testcase_17 AC 3 ms
4,348 KB
testcase_18 AC 3 ms
4,348 KB
testcase_19 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:59: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
    9 | #define wt1(v) ({char wbuf[64],*wp=wbuf+sizeof wbuf;wt(v);write(1,wp,wbuf+sizeof wbuf-wp);})
      |                                                           ^~~~~
main.c:51:9: note: in expansion of macro ‘wt1’
   51 |         wt1(f2(f1()));
      |         ^~~
main.c:52:9: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
   52 |         _exit(0);
      |         ^~~~~
main.c:52:9: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]

ソースコード

diff #

#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_skip() while(*rp++>=48)
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define rd_signed() ({int _s=*rp=='-'&&++rp,_v=rd();_s?-_v:_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 rep4(v,s,e,t) for(typeof(e) v=s;v<e;v+=t)
#define chmax(v,a) (v=v>=a?v:a)

int xy[400];

int f1(){
	int n=0;
	rd_init();
	rd_skip();
	while(*rp){
		xy[n++]=rd_signed();
	}
	return n;
}

int f2(int n){
	int b=0;
	rep4(i,0,n,2){
		int rx=xy[i+0];
		int ry=xy[i+1];
		rep4(j,i+2,n,2){
			int lx=xy[j+0]-rx;
			int ly=xy[j+1]-ry;
			int o=ly*rx-lx*ry;
			if(lx|ly){
				int c=0;
				rep4(k,0,n,4){
					int px=xy[k+0];
					int py=xy[k+1];
					int qx=xy[k+2];
					int qy=xy[k+3];
					c+=(lx*py-ly*px+o)*(lx*qy-ly*qx+o)<=0;
				}
				chmax(b,c);
			}
		}
	}
	return b;
}

int main(){
	wt1(f2(f1()));
	_exit(0);
}
0