結果

問題 No.2463 ストレートフラッシュ
ユーザー tails
提出日時 2023-09-09 22:54:22
言語 C90
(gcc 12.3.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,463 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 27,392 KB
最終ジャッジ日時 2025-01-07 06:00:23
合計ジャッジ時間 1,438 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'f2':
main.c:31:13: error: expected ';' before 'y'
   31 |         rep(y,m){
      |             ^
main.c:8:32: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:31:13: error: 'y' undeclared (first use in this function)
   31 |         rep(y,m){
      |             ^
main.c:8:36: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:31:13: note: each undeclared identifier is reported only once for each function it appears in
   31 |         rep(y,m){
      |             ^
main.c:8:36: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:33:21: error: expected ';' before 'x'
   33 |                 rep(x,n-3){
      |                     ^
main.c:8:32: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:33:21: error: 'x' undeclared (first use in this function)
   33 |                 rep(x,n-3){
      |                     ^
main.c:8:36: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:11:35: error: expected ';' before 't'
   11 | #define se(a,b) (a<b||({typeof(a) t=a;a=b;b=t;}))
      |                                   ^
main.c:42:33: note: in expansion of macro 'se'
   42 |                                 se(a0,a1);
      |                                 ^~
main.c:11:35: error: expected ';' before 't'
   11 | #define se(a,b) (a<b||({typeof(a) t=a;a=b;b=t;}))
      |                                   ^
main.c:43:33: note: in expansion of macro 'se'
   43 |                                 se(a0,a2);
      |                                 ^~
main.c:11:35: error: expected ';' before 't'
   11 | #define se(a,b) (a<b||({typeof(

ソースコード

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() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) ({ulong _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 max(a,b) (a>=b?a:b)
#define chmin(v,a) (v=v<=a?v:a)
#define se(a,b) (a<b||({typeof(a) t=a;a=b;b=t;}))

typedef unsigned long ulong;

int a[512][512];

void f1(int*np,int*mp){
	rd_init();
	*np=rd();
	*mp=rd();
	int j=0;
	while(*rp){
		int x=rd();
		int y=rd();
		a[y-1][x-1]=j++;
	}
}

int f2(int n,int m){
	int z=1<<18;
	rep(y,m){
		a[y][n]=a[y][0];
		rep(x,n-3){
			int a0=a[y][x+0];
			int a1=a[y][x+1];
			int a2=a[y][x+2];
			int a3=a[y][x+3];
			int a4=a[y][x+4];
			int i=4;
			int t=0;
			{
				se(a0,a1);
				se(a0,a2);
				se(a0,a3);
				se(a0,a4);
				int d=(max(a0-i,0)+4)/5u;
				i+=d*5;
				t+=d;
			}
			{
				se(a1,a2);
				se(a1,a3);
				se(a1,a4);
				int d=(max(a1-i,0)+3)/4u;
				i+=d*4;
				t+=d;
			}
			{
				se(a2,a3);
				se(a2,a4);
				int d=(max(a2-i,0)+2)/3u;
				i+=d*3;
				t+=d;
			}
			{
				se(a3,a4);
				int d=(max(a3-i,0)+1)/2u;
				i+=d*2;
				t+=d;
			}
			{
				int d=(max(a4-i,0)+0)/1u;
				i+=d*1;
				t+=d;
			}
			chmin(z,t);
		}
	}
	return z;
}

int main(){
	int n,m;
	f1(&n,&m);
	int z=f2(n,m);
	wt1(z);
	_exit(0);
}
0