結果

問題 No.1439 Let's Compare!!!!
ユーザー tailstails
提出日時 2021-03-26 23:04:32
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 944 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 32,000 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-06 22:30:21
合計ジャッジ時間 2,017 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 1 ms
6,812 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 6 ms
6,940 KB
testcase_11 AC 12 ms
6,944 KB
testcase_12 AC 10 ms
6,944 KB
testcase_13 AC 7 ms
6,940 KB
testcase_14 AC 7 ms
6,944 KB
testcase_15 AC 16 ms
6,944 KB
testcase_16 AC 17 ms
6,944 KB
testcase_17 AC 17 ms
6,940 KB
testcase_18 AC 9 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:14:1: warning: return type defaults to 'int' [-Wimplicit-int]
   14 | main(){
      | ^~~~
main.c: In function 'main':
main.c:18:9: warning: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
   18 |         memcpy(s,rp,n); rp+=n+1;
      |         ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memcpy'
  +++ |+#include <string.h>
    1 | #pragma GCC optimize("Ofast")
main.c:18:9: warning: incompatible implicit declaration of built-in function 'memcpy' [-Wbuiltin-declaration-mismatch]
   18 |         memcpy(s,rp,n); rp+=n+1;
      |         ^~~~~~
main.c:18:9: note: include '<string.h>' or provide a declaration of 'memcpy'
main.c:46:39: warning: implicit declaration of function 'memcmp' [-Wimplicit-function-declaration]
   46 |                                 *wp++=memcmp(s+j,t+j,64)<0?'<':'>';
      |                                       ^~~~~~
main.c:46:39: note: include '<string.h>' or provide a declaration of 'memcmp'
main.c:46:54: warning: 'memcmp' argument 3 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   46 |                                 *wp++=memcmp(s+j,t+j,64)<0?'<':'>';
      |                                                      ^~
<built-in>: note: built-in 'memcmp' declared here
main.c:54:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   54 |         write(1,wbuf,wp-wbuf);
      |         ^~~~~
main.c:55:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   55 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

#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];

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

char s[200000],t[200000];
unsigned long b1[64],b0[64*64];

main(){
	char*rp=mmap(0l,1l<<28,1,2,0,0ll);
	char*wp=wbuf;
	rd(n);
	memcpy(s,rp,n); rp+=n+1;
	memcpy(t,rp,n); rp+=n+1;
	rep(x,n){
		if(s[x]!=t[x]){
			b0[x>>6]|=1l<<(x>>0&63);
			b1[x>>12]|=1l<<(x>>6&63);
		}
	}
	rd(q);
	while(q--){
		int c=*rp; rp+=2;
		rd(x); --x;
		int y=*rp; rp+=2;
		(c&1?s:t)[x]=y;
		if(s[x]!=t[x]){
			b0[x>>6]|=1l<<(x>>0&63);
			b1[x>>12]|=1l<<(x>>6&63);
		}else{
			b0[x>>6]&=~(1l<<(x>>0&63));
			if(!b0[x>>6]){
				b1[x>>12]&=~(1l<<(x>>6&63));
			}
		}
		rep(j,64){
			if(b1[j]){
				j<<=6;
				while(!b0[j])++j;
				j<<=6;
				*wp++=memcmp(s+j,t+j,64)<0?'<':'>';
				goto hoge;
			}
		}
		*wp++='=';
		hoge:;
		*wp++=10;
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0