結果
問題 |
No.5022 XOR Printer
|
ユーザー |
![]() |
提出日時 | 2025-07-26 16:29:05 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 1,031 bytes |
コンパイル時間 | 988 ms |
コンパイル使用メモリ | 27,460 KB |
実行使用メモリ | 7,716 KB |
スコア | 5,202,595,907 |
最終ジャッジ日時 | 2025-07-26 16:29:10 |
合計ジャッジ時間 | 2,447 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
コンパイルメッセージ
main.c: In function ‘p’: main.c:8:9: warning: implicit declaration of function ‘puts’ [-Wimplicit-function-declaration] 8 | puts(&c); | ^~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘puts’ +++ |+#include <stdio.h> 1 | int s; main.c:8:14: warning: passing argument 1 of ‘puts’ from incompatible pointer type [-Wincompatible-pointer-types] 8 | puts(&c); | ^~ | | | int * main.c:8:14: note: expected ‘const char *’ but argument is of type ‘int *’ main.c:10:17: warning: implicit declaration of function ‘go’ [-Wimplicit-function-declaration] 10 | go(0,5); | ^~ main.c:19:17: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration] 19 | exit(0); | ^~~~ main.c:1:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’ +++ |+#include <stdlib.h> 1 | int s; main.c:19:17: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch] 19 | exit(0); | ^~~~ main.c:19:17: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’ main.c: At top level: main.c:23:6: warning: conflicting types for ‘go’; have ‘void(int, int)’ 23 | void go(int v,int u){ | ^~ main.c:10:17: note: previous implicit declaration of ‘go’ with type ‘void(int, int)’ 10 | go(0,5); | ^~ main.c:41:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 41 | main(){ | ^~~~ main.c: In function ‘main’: main.c:42:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 42 | scanf("%d",&n); | ^~~~~ main.c:42:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:42:9:
ソースコード
int s; int t; int n; int x,y; int a[10][10]; void p(int c){ puts(&c); if(--t==20){ go(0,5); p('C'); s^=a[0][5]; go(0,4); p('C'); s^=a[0][4]; go(0,5); p('W'); a[0][5]^=s; exit(0); } } void go(int v,int u){ while(y<v)++y,p('D'); while(y>v)--y,p('U'); while(x<u)++x,p('R'); while(x>u)--x,p('L'); } void loc(int q,int *pv,int *pu){ if(q>=50){ loc(q-50,pv,pu); *pv=9-*pv; *pu=9-*pu; }else{ *pv=q/5; *pu=q/5%2?q%5:4-q%5; } } main(){ scanf("%d",&n); scanf("%d",&t); for(int v=0;v<10;++v){ for(int u=0;u<10;++u){ scanf("%d",&a[v][u]); } } for(int b=20;b--;){ dprintf(2,"b=%d\n",b); int v,u; for(int q=0;q<100;++q){ loc(q,&v,&u); if((s^a[v][u])>>b==1){ go(v,u); p('C'); s^=a[v][u]; break; } } if(s>>b!=1){ continue; } for(int q=0;q<100;++q){ loc(q,&v,&u); if(!(a[v][u]>>b&1)){ go(v,u); p('W'); a[v][u]^=s; } } if(b<19){ loc(100-(19-b),&v,&u); go(v,u); p('W'); a[v][u]^=s; p('C'); s^=a[v][u]; } } }