結果
| 問題 | No.2064 Smallest Sequence on Grid |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2024-12-25 14:34:06 |
| 言語 | C90 (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,176 bytes |
| 記録 | |
| コンパイル時間 | 221 ms |
| コンパイル使用メモリ | 25,524 KB |
| 最終ジャッジ日時 | 2026-02-24 01:21:57 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'main':
main.c:24:13: error: expected ';' before 'i'
24 | rep(i,h+w-2){
| ^
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:24:13: error: 'i' undeclared (first use in this function)
24 | rep(i,h+w-2){
| ^
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:24:13: note: each undeclared identifier is reported only once for each function it appears in
24 | rep(i,h+w-2){
| ^
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:22: error: expected ';' before 'y'
28 | reps(y,s,e){
| ^
main.c:9:34: note: in definition of macro 'reps'
9 | #define reps(v,s,e) for(typeof(e)v=s;v<e;++v)
| ^
main.c:28:22: error: 'y' undeclared (first use in this function)
28 | reps(y,s,e){
| ^
main.c:9:38: note: in definition of macro 'reps'
9 | #define reps(v,s,e) for(typeof(e)v=s;v<e;++v)
| ^
main.c:40:23: error: expected ';' before 'y'
40 | rreps(y,s,e){
| ^
main.c:10:35: note: in definition of macro 'rreps'
10 | #define rreps(v,s,e) for(typeof(e)v=e;--v>=s;)
| ^
ソースコード
#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 reps(v,s,e) for(typeof(e)v=s;v<e;++v)
#define rreps(v,s,e) for(typeof(e)v=e;--v>=s;)
#define min(a,b) (a<=b?a:b)
#define max(a,b) (a>=b?a:b)
#define chmin(v,a) (v=v<=a?v:a)
char wbuf[6000];
char a[3000];
int main(){
rd_init();
int h=rd();
int w=rd();
a[0]=1;
wbuf[0]=*rp;
rep(i,h+w-2){
int b=127;
int s=max(0,i-w-1);
int e=min(h,i+1);
reps(y,s,e){
if(a[y]){
int x=i-y;
if(x+1<w){
chmin(b,rp[y*(w+1)+(x+1)]);
}
if(y+1<h){
chmin(b,rp[(y+1)*(w+1)+x]);
}
}
}
wbuf[i+1]=b;
rreps(y,s,e){
if(a[y]){
a[y]=0;
int x=i-y;
if(x+1<w){
if(rp[y*(w+1)+(x+1)]==b){
a[y]=1;
}
}
if(y+1<h){
if(rp[(y+1)*(w+1)+x]==b){
a[y+1]=1;
}
}
}
}
}
write(1,wbuf,h+w-1);
_exit(0);
}
tails