結果
| 問題 |
No.1434 Make Maze
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2021-03-19 23:02:56 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,177 bytes |
| コンパイル時間 | 563 ms |
| コンパイル使用メモリ | 35,840 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-19 00:40:29 |
| 合計ジャッジ時間 | 3,979 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 20 |
コンパイルメッセージ
main.c: In function 'muri':
main.c:10:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
10 | write(1,"-1\n",3);
| ^~~~~
main.c:11:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
11 | _exit(0);
| ^~~~~
| _Exit
main.c: At top level:
main.c:16:1: warning: return type defaults to 'int' [-Wimplicit-int]
16 | main(){
| ^~~~
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char*mmap();
#define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
char wbuf[1<<28];
void muri(){
write(1,"-1\n",3);
_exit(0);
}
#define DIG(u,v) wbuf[(y*2+v)*(w*2)+(x*2+u)]='.'
main(){
char*rp=mmap(0l,1l<<28,1,2,0,0ll);
RD(h); h=h+1>>1;
RD(w); w=w+1>>1;
RD(q);
if(q&1) muri();
q>>=1;
int hw=h*w-(h&w&1)-1;
if(hw-q<0) muri();
if(hw-q&1) muri();
int z=0;
for(int y=0;y<h*2-1;++y){
for(int x=0;x<w*2-1;++x){
wbuf[z++]=(y|x)&1?'#':'.';
}
wbuf[z++]=10;
}
for(int y=0;y<h;++y){
for(int x=0;x<w-(y==h-1);++x){
if(h&1||y<h-2){
if(y&1){
if((y*w+(w-1-x))+(w-1-x)+(h-1-y)>=q){
DIG(0,1);
}else{
if(x){
DIG(-1,0);
}else{
DIG(0,1);
}
}
}else{
if(x<w-1){
DIG(1,0);
}else{
DIG(0,1);
}
}
}else{
if(y==h-2){
if(x&1||x==w-1){
DIG(1,0);
}else{
DIG(0,1);
}
}else{
if(x&1){
if(((h-2)*w+x*2+1)+(w-1-x)+(h-1-y)>=q){
DIG(1,0);
}else{
DIG(0,-1);
}
}else{
DIG(1,0);
}
}
}
}
}
write(1,wbuf,z);
_exit(0);
}
tails