結果

問題 No.2684 折々の色
ユーザー tailstails
提出日時 2024-03-21 15:56:43
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 1,233 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 27,136 KB
実行使用メモリ 17,752 KB
最終ジャッジ日時 2024-03-21 15:56:51
合計ジャッジ時間 7,623 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 1 ms
6,676 KB
testcase_11 AC 18 ms
10,840 KB
testcase_12 AC 11 ms
8,792 KB
testcase_13 AC 18 ms
10,840 KB
testcase_14 AC 11 ms
8,792 KB
testcase_15 AC 13 ms
8,664 KB
testcase_16 AC 5 ms
6,676 KB
testcase_17 AC 11 ms
8,408 KB
testcase_18 AC 19 ms
9,432 KB
testcase_19 AC 20 ms
11,992 KB
testcase_20 AC 15 ms
10,584 KB
testcase_21 AC 7 ms
6,676 KB
testcase_22 AC 18 ms
9,560 KB
testcase_23 AC 17 ms
10,200 KB
testcase_24 AC 9 ms
7,128 KB
testcase_25 AC 12 ms
8,280 KB
testcase_26 AC 19 ms
11,736 KB
testcase_27 AC 13 ms
9,048 KB
testcase_28 AC 14 ms
10,200 KB
testcase_29 AC 32 ms
17,368 KB
testcase_30 AC 32 ms
16,472 KB
testcase_31 AC 33 ms
16,472 KB
testcase_32 AC 35 ms
17,496 KB
testcase_33 AC 34 ms
17,536 KB
testcase_34 AC 33 ms
16,344 KB
testcase_35 AC 30 ms
16,472 KB
testcase_36 AC 32 ms
16,384 KB
testcase_37 AC 32 ms
16,472 KB
testcase_38 AC 36 ms
17,664 KB
testcase_39 AC 32 ms
17,752 KB
testcase_40 AC 35 ms
17,752 KB
testcase_41 AC 33 ms
17,752 KB
testcase_42 AC 33 ms
17,752 KB
testcase_43 AC 34 ms
17,752 KB
testcase_44 AC 34 ms
17,752 KB
testcase_45 AC 34 ms
17,752 KB
testcase_46 AC 34 ms
17,752 KB
testcase_47 AC 1 ms
6,676 KB
testcase_48 AC 2 ms
6,676 KB
testcase_49 AC 1 ms
6,676 KB
testcase_50 AC 1 ms
6,676 KB
testcase_51 AC 2 ms
6,676 KB
testcase_52 AC 2 ms
6,676 KB
testcase_53 AC 2 ms
6,676 KB
testcase_54 AC 1 ms
6,676 KB
testcase_55 AC 2 ms
6,676 KB
testcase_56 AC 1 ms
6,676 KB
testcase_57 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:58:25: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
   58 |                         write(1,"Yes",3);
      |                         ^~~~~
main.c:59:25: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
   59 |                         _exit(0);
      |                         ^~~~~
main.c:59:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
main.c:75:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
   75 |                         _exit(0);
      |                         ^~~~~
main.c:79:9: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
   79 |         _exit(0);
      |         ^~~~~

ソースコード

diff #

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

#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define rep(v,e) for(typeof(e) v=0;v<e;++v)

#define HASH_BITS 18
#define HASH_MASK ((1<<HASH_BITS)-1)
long hash[1<<HASH_BITS];
int hash_add(long x){
	int h=x&HASH_MASK;
	while(1){
		if(hash[h]==0){
			hash[h]=x;
			return h;
		}
		if(hash[h]==x){
			return h;
		}
		h=h+1&HASH_MASK;
	}
}

int hs[200000];
int ws[200000];
int count[1<<HASH_BITS];

int main(){
	rd_init();
	int n=rd();
	int m=rd();
	int xs[10];
	rep(j,m){
		xs[j]=rd()*10000;
	}
	rep(i,n){
		int cs[10];
		rep(j,m){
			cs[j]=rd();
		}
		int t=rd();
		{
			long r=1;
			rep(j,m){
				r=r*257+cs[j]*t;
			}
			hs[i]=hash_add(r);
			count[hs[i]]+=1;
		}
		ws[i]=-1;
		if(t==100){
			rep(j,m){
				if(xs[j]!=cs[j]*10000){
					goto next;
				}
			}
			write(1,"Yes",3);
			_exit(0);
		}else{
			long r=1;
			rep(j,m){
				int u=xs[j]-cs[j]*t*100;
				int v=100-t;
				if(u%v) goto next;
				r=r*257+u/v;
			}
			ws[i]=hash_add(r);
		}
		next:;
	}
	rep(i,n){
		if(ws[i]>=0&&count[ws[i]]>(hs[i]==ws[i])){
			write(1,"Yes",3);
			_exit(0);
		}
	}
	write(1,"No",2);
	_exit(0);
}
0