結果
| 問題 | No.1377 Half xor Half |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2021-02-08 18:29:06 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 659 bytes |
| 記録 | |
| コンパイル時間 | 132 ms |
| コンパイル使用メモリ | 28,316 KB |
| 最終ジャッジ日時 | 2026-02-22 06:44:37 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c:7:1: warning: data definition has no type or storage class
7 | rs[1000],rn;
| ^~
main.c:7:1: error: type defaults to 'int' in declaration of 'rs' [-Wimplicit-int]
main.c:7:10: error: type defaults to 'int' in declaration of 'rn' [-Wimplicit-int]
7 | rs[1000],rn;
| ^~
main.c:9:1: error: return type defaults to 'int' [-Wimplicit-int]
9 | main(){
| ^~~~
main.c: In function 'main':
main.c:10:17: error: too many arguments to function 'mmap'; expected 0, have 6
10 | char*rp=mmap(0l,1l<<28,1,2,0,0ll);
| ^~~~ ~~
main.c:4:6: note: declared here
4 | char*mmap();
| ^~~~
main.c:29:25: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
29 | puts("-1");
| ^~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'puts'
+++ |+#include <stdio.h>
1 | #pragma GCC optimize("Ofast")
main.c:30:25: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
30 | exit(0);
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | #pragma GCC optimize("Ofast")
main.c:30:25: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
30 | exit(0);
| ^~~~
main.c:30:25: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c:36:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
36 | printf("%d\n",rn);
| ^~~~~~
main.c:36:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:36:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:36:9: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
#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;}
rs[1000],rn;
main(){
char*rp=mmap(0l,1l<<28,1,2,0,0ll);
RD(n);
char*s=rp;
char*t=rp+(n*2+1);
int rn=0;
for(int i=0;i<n;++i){
int s0=s[i];
int s1=s[i+n];
int s2=s0^s1^'0';
int t0=t[i];
int t1=t[i+n];
if(t0==s0&&t1==s1){
}else if(t0==s2&&t1==s0){
rs[rn++]=i;
rs[rn++]=i+1;
}else if(t0==s1&&t1==s2){
rs[rn++]=i+n;
rs[rn++]=i+n+1;
}else{
puts("-1");
exit(0);
}
}
if(rn>0&&rs[rn-1]==n*2){
rs[rn-1]=0;
}
printf("%d\n",rn);
for(int i=0;i<rn;++i){
printf("%d\n",rs[i]);
}
}
tails