結果
| 問題 | No.2675 KUMA |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2024-03-18 17:23:23 |
| 言語 | C90 (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,403 bytes |
| 記録 | |
| コンパイル時間 | 120 ms |
| コンパイル使用メモリ | 26,296 KB |
| 最終ジャッジ日時 | 2026-02-24 01:18:25 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'f0':
main.c:18:13: error: expected ';' before 'i'
18 | rep(i,1<<16){
| ^
main.c:6:32: note: in definition of macro 'rep'
6 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:18:13: error: 'i' undeclared (first use in this function)
18 | rep(i,1<<16){
| ^
main.c:6:36: note: in definition of macro 'rep'
6 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:18:13: note: each undeclared identifier is reported only once for each function it appears in
18 | rep(i,1<<16){
| ^
main.c:6:36: note: in definition of macro 'rep'
6 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c: In function 'f1':
main.c:28:13: error: expected ';' before 'i'
28 | rep(i,n){
| ^
main.c:6:32: note: in definition of macro 'rep'
6 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:28:13: error: 'i' undeclared (first use in this function)
28 | rep(i,n){
| ^
main.c:6:36: note: in definition of macro 'rep'
6 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:32:21: error: expected ';' before 'j'
32 | rep(j,8){
| ^
main.c:6:32: note: in definition of macro 'rep'
6 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:32:21: error: 'j' undeclared (first use in this function)
32 | rep(j,8){
| ^
main.c:6:36: note: in definition of macro 'rep'
6 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c: In function 'f2':
main.c:48:13: error: expected ';' before 'ki'
48 | rep(ki,kn){
| ^~
main.c:6:32
ソースコード
#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 rep(v,e) for(typeof(e) v=0;v<e;++v)
#define rept(v,e,t) for(typeof(e) v=0;v<e;v+=t)
static const int d[]={1,-1,-2,-2,-1,+1,+2,+2,+1,-1};
char a[1<<16];
char b[1<<16];
int ps[1009][1009];
int kv[1005][1005];
int kxs[128],kys[128];
void f0(){
rep(i,1<<16){
b[i]=17;
}
b[0]=0;
}
void f1(int*pn,int*pkn){
rd_init();
int n=rd();
int kn=0;
rep(i,n){
int x=rd();
int y=rd();
ps[y+4][x+4]=1<<i;
rep(j,8){
int kx=x-d[j+0];
int ky=y-d[j+2];
if(!kv[ky+2][kx+2]){
kv[ky+2][kx+2]=1;
kxs[kn]=kx;
kys[kn]=ky;
++kn;
}
}
}
*pn=n;
*pkn=kn;
}
void f2(int n,int kn){
rep(ki,kn){
int kx=kxs[ki];
int ky=kys[ki];
if(!ps[ky+4][kx+4]){
rep(i,1<<16){
a[i]=b[i];
}
rept(j,8,2){
int p=0;
rep(c,2){
p|=ps[ky+d[j+c+2]+4][kx+d[j+c]+4];
}
if(p){
rep(i,1<<n){
if(b[i|p]>a[i]+1){
b[i|p]=a[i]+1;
}
}
}
}
}
}
}
void f3(int n){
int z=b[(1<<n)-1];
if(z<17){
char buf[2];
if(z<10){
buf[0]=z+48;
write(1,buf,1);
}else{
buf[0]=z/10+48;
buf[1]=z%10+48;
write(1,buf,2);
}
}else{
write(1,"-1",2);
}
}
int main(){
f0();
int n,kn;
f1(&n,&kn);
f2(n,kn);
f3(n);
_exit(0);
}
tails