結果

問題 No.2684 折々の色
ユーザー tailstails
提出日時 2024-03-21 16:05:08
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 1,236 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 27,392 KB
実行使用メモリ 17,752 KB
最終ジャッジ日時 2024-03-21 16:05:15
合計ジャッジ時間 5,914 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 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 2 ms
6,676 KB
testcase_11 AC 19 ms
10,840 KB
testcase_12 AC 15 ms
8,792 KB
testcase_13 AC 23 ms
10,840 KB
testcase_14 AC 14 ms
8,792 KB
testcase_15 AC 14 ms
8,664 KB
testcase_16 AC 6 ms
6,676 KB
testcase_17 AC 13 ms
8,408 KB
testcase_18 AC 19 ms
9,432 KB
testcase_19 AC 24 ms
11,992 KB
testcase_20 AC 17 ms
10,584 KB
testcase_21 AC 7 ms
6,676 KB
testcase_22 AC 23 ms
9,560 KB
testcase_23 AC 18 ms
10,200 KB
testcase_24 AC 10 ms
7,128 KB
testcase_25 AC 13 ms
8,280 KB
testcase_26 AC 22 ms
11,736 KB
testcase_27 AC 16 ms
9,048 KB
testcase_28 AC 17 ms
10,200 KB
testcase_29 AC 37 ms
17,368 KB
testcase_30 AC 35 ms
16,472 KB
testcase_31 AC 36 ms
16,472 KB
testcase_32 AC 38 ms
17,496 KB
testcase_33 AC 38 ms
16,256 KB
testcase_34 AC 34 ms
16,344 KB
testcase_35 AC 36 ms
16,472 KB
testcase_36 AC 38 ms
15,104 KB
testcase_37 AC 35 ms
16,472 KB
testcase_38 AC 39 ms
16,384 KB
testcase_39 AC 36 ms
17,752 KB
testcase_40 AC 37 ms
17,752 KB
testcase_41 AC 39 ms
17,752 KB
testcase_42 AC 36 ms
17,752 KB
testcase_43 AC 40 ms
17,752 KB
testcase_44 AC 39 ms
17,752 KB
testcase_45 AC 41 ms
17,752 KB
testcase_46 AC 38 ms
17,752 KB
testcase_47 AC 2 ms
6,676 KB
testcase_48 AC 1 ms
6,676 KB
testcase_49 AC 2 ms
6,676 KB
testcase_50 AC 2 ms
6,676 KB
testcase_51 AC 1 ms
6,676 KB
testcase_52 AC 2 ms
6,676 KB
testcase_53 AC 2 ms
6,676 KB
testcase_54 AC 2 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:59:25: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
   59 |                         write(1,"Yes",3);
      |                         ^~~~~
main.c:60:25: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
   60 |                         _exit(0);
      |                         ^~~~~
main.c:60:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
main.c:77:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
   77 |                         _exit(0);
      |                         ^~~~~
main.c:81:9: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
   81 |         _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 k=0;
	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;
			}
			int h=hash_add(r);
			hs[k]=h;
			count[h]+=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[k]=hash_add(r);
		}
		++k;
		next:;
	}
	rep(i,k){
		if(count[ws[i]]>(hs[i]==ws[i])){
			write(1,"Yes",3);
			_exit(0);
		}
	}
	write(1,"No",2);
	_exit(0);
}
0