結果

問題 No.2502 Optimization in the Dark
ユーザー tailstails
提出日時 2023-10-16 10:24:11
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 1,783 ms
コンパイル使用メモリ 28,344 KB
実行使用メモリ 24,360 KB
平均クエリ数 4.00
最終ジャッジ日時 2023-10-16 10:24:19
合計ジャッジ時間 7,593 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,364 KB
testcase_01 AC 22 ms
24,024 KB
testcase_02 AC 22 ms
24,360 KB
testcase_03 AC 23 ms
24,000 KB
testcase_04 AC 22 ms
24,024 KB
testcase_05 AC 23 ms
24,348 KB
testcase_06 AC 24 ms
24,048 KB
testcase_07 AC 24 ms
23,880 KB
testcase_08 AC 25 ms
24,324 KB
testcase_09 AC 22 ms
24,312 KB
testcase_10 AC 22 ms
23,652 KB
testcase_11 AC 23 ms
23,508 KB
testcase_12 AC 22 ms
23,832 KB
testcase_13 AC 24 ms
23,652 KB
testcase_14 AC 23 ms
24,360 KB
testcase_15 AC 24 ms
24,336 KB
testcase_16 AC 23 ms
23,376 KB
testcase_17 AC 23 ms
23,820 KB
testcase_18 AC 24 ms
24,036 KB
testcase_19 AC 24 ms
23,376 KB
testcase_20 AC 22 ms
24,264 KB
testcase_21 AC 24 ms
23,508 KB
testcase_22 AC 23 ms
23,220 KB
testcase_23 AC 23 ms
23,508 KB
testcase_24 AC 23 ms
24,252 KB
testcase_25 AC 23 ms
23,628 KB
testcase_26 AC 23 ms
23,508 KB
testcase_27 AC 23 ms
23,832 KB
testcase_28 AC 23 ms
24,012 KB
testcase_29 AC 24 ms
23,388 KB
testcase_30 AC 23 ms
24,012 KB
testcase_31 AC 24 ms
23,616 KB
testcase_32 AC 23 ms
23,412 KB
testcase_33 AC 24 ms
23,820 KB
testcase_34 AC 23 ms
23,400 KB
testcase_35 AC 23 ms
24,336 KB
testcase_36 AC 24 ms
24,024 KB
testcase_37 AC 23 ms
23,364 KB
testcase_38 AC 24 ms
24,012 KB
testcase_39 AC 24 ms
23,352 KB
testcase_40 AC 23 ms
24,012 KB
testcase_41 AC 23 ms
23,640 KB
testcase_42 AC 24 ms
23,820 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘q’:
main.c:9:2: warning: implicit declaration of function ‘dprintf’ [-Wimplicit-function-declaration]
  dprintf(1,"? %d %d %d %d\n",i,x,j,x);
  ^~~~~~~
main.c:10:2: warning: implicit declaration of function ‘read’; did you mean ‘rep’? [-Wimplicit-function-declaration]
  read(0,buf,8);
  ^~~~
  rep
main.c: At top level:
main.c:14:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main(){
 ^~~~
main.c: In function ‘main’:
main.c:17:4: warning: implicit declaration of function ‘atoi’ [-Wimplicit-function-declaration]
  n=atoi(buf);
    ^~~~
main.c:37:2: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  write(1,(char*)buf+3,n*12+2);
  ^~~~~
main.c:38:2: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
  _exit(0);
  ^~~~~
main.c:38:2: warning: incompatible implicit declaration of built-in function ‘_exit’

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define rep(v,e) for(typeof(e) v=0;v<e;++v)

unsigned buf[512];

int q(int i,int j,int x){
	dprintf(1,"? %d %d %d %d\n",i,x,j,x);
	read(0,buf,8);
	return *buf&1?j:i;
}

main(){
	int n,a,b,c;
	read(0,buf,8);
	n=atoi(buf);
	a=q(q(1,2,n*2),3,n*2);
	b=q(a%3+1,(a+1)%3+1,n);
	c=a^b;
	unsigned*p=buf;
	*p++='!'<<24;
	unsigned v;
	v=0x200020|a+48<<8|b+48<<24;
	rep(i,n){
		*p++=v;
	}
	v=0x200020|a+48<<8|c+48<<24;
	rep(i,n){
		*p++=v;
	}
	v=0x200020|b+48<<8|c+48<<24;
	rep(i,n){
		*p++=v;
	}
	*p='\n';
	write(1,(char*)buf+3,n*12+2);
	_exit(0);
}
0