結果

問題 No.2982 Logic Battle
コンテスト
ユーザー 👑 tails
提出日時 2024-12-07 21:23:40
言語 C90
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,271 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 93 ms
コンパイル使用メモリ 26,164 KB
最終ジャッジ日時 2026-02-24 01:21:23
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'main':
main.c:9:32: error: expected ';' before '_'
    9 | #define repeat(e) for(typeof(e)_=e;_--;)
      |                                ^
main.c:22:9: note: in expansion of macro 'repeat'
   22 |         repeat(n){
      |         ^~~~~~
main.c:9:36: error: '_' undeclared (first use in this function)
    9 | #define repeat(e) for(typeof(e)_=e;_--;)
      |                                    ^
main.c:22:9: note: in expansion of macro 'repeat'
   22 |         repeat(n){
      |         ^~~~~~
main.c:9:36: note: each undeclared identifier is reported only once for each function it appears in
    9 | #define repeat(e) for(typeof(e)_=e;_--;)
      |                                    ^
main.c:22:9: note: in expansion of macro 'repeat'
   22 |         repeat(n){
      |         ^~~~~~
main.c:23:21: error: expected ';' before 'i'
   23 |                 rep(i,3){
      |                     ^
main.c:8:31: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
      |                               ^
main.c:23:21: error: 'i' undeclared (first use in this function)
   23 |                 rep(i,3){
      |                     ^
main.c:8:35: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
      |                                   ^
main.c:26:29: error: expected ';' before 'j'
   26 |                         rep(j,3){
      |                             ^
main.c:8:31: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
      |                               ^
main.c:26:29: error: 'j' undeclared (first use in this function)
   26 |                         rep(j,3){
      |                             ^
main.c:8:35: note: in definition of macro 'rep'
    8 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
      |                                   ^
main.c:28:45: error: expected ';' before 'k'
   28 |                                         rep(k,sn[j]){
      |

ソースコード

diff #
raw source code

#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 repeat(e) for(typeof(e)_=e;_--;)
#define chmax(v,a) (v=v>=a?v:a)

typedef unsigned long ulong;
typedef struct{long d,x;}A;

A s[3][32],t[3][32];
int sn[3],tn[3];

int main(){
	sn[0]=sn[1]=1;
	rd_init();
	long n=rd();
	repeat(n){
		rep(i,3){
			long a=rd();
			tn[i]=0;
			rep(j,3){
				if(i!=j){
					rep(k,sn[j]){
						long x=s[j][k].x+a;
						long d=s[j][k].d+x;
						x=x?x-1:0;
						rep(tr,tn[i]){
							if(t[i][tr].d>=d&&t[i][tr].x>=x){
								goto hoge;
							}
						}
						int tw=0;
						rep(tr,tn[i]){
							if(!(t[i][tr].d<=d&&t[i][tr].x<=x)){
								t[i][tw++]=t[i][tr];
							}
						}
						t[i][tw].x=x;
						t[i][tw].d=d;
						tn[i]=tw+1;
						hoge:;
					}
				}
			}
		}
		rep(i,3){
			sn[i]=tn[i];
			rep(k,tn[i]){
				s[i][k]=t[i][k];
			}
		}
	}
	long z=0;
	rep(i,3){
		rep(k,sn[i]){
			chmax(z,s[i][k].d);
		}
	}
	wt1(z);
	_exit(0);
}
0