結果
| 問題 |
No.2684 折々の色
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2024-03-21 16:05:08 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 1,236 bytes |
| コンパイル時間 | 1,282 ms |
| コンパイル使用メモリ | 26,496 KB |
| 実行使用メモリ | 17,756 KB |
| 最終ジャッジ日時 | 2024-09-30 10:09:05 |
| 合計ジャッジ時間 | 4,632 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 56 |
コンパイルメッセージ
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);
| ^~~~~
ソースコード
#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);
}
tails