結果
問題 | No.1245 ANDORゲーム(calc) |
ユーザー | fura |
提出日時 | 2020-10-02 22:31:12 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 616 bytes |
コンパイル時間 | 2,054 ms |
コンパイル使用メモリ | 203,872 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-17 22:04:49 |
合計ジャッジ時間 | 5,639 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 4 ms
6,944 KB |
testcase_08 | AC | 2 ms
6,944 KB |
testcase_09 | AC | 4 ms
6,944 KB |
testcase_10 | AC | 3 ms
6,940 KB |
testcase_11 | AC | 90 ms
6,944 KB |
testcase_12 | AC | 90 ms
6,940 KB |
testcase_13 | AC | 90 ms
6,940 KB |
testcase_14 | AC | 88 ms
6,940 KB |
testcase_15 | AC | 89 ms
6,944 KB |
testcase_16 | AC | 89 ms
6,944 KB |
testcase_17 | AC | 76 ms
6,944 KB |
testcase_18 | AC | 71 ms
6,944 KB |
testcase_19 | AC | 67 ms
6,940 KB |
testcase_20 | AC | 77 ms
6,940 KB |
testcase_21 | AC | 75 ms
6,940 KB |
testcase_22 | AC | 69 ms
6,940 KB |
testcase_23 | AC | 83 ms
6,944 KB |
testcase_24 | AC | 82 ms
6,940 KB |
testcase_25 | AC | 42 ms
6,940 KB |
testcase_26 | AC | 43 ms
6,944 KB |
testcase_27 | AC | 54 ms
6,940 KB |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; using lint=long long; int main(){ int n,q; scanf("%d%d",&n,&q); vector<int> a(n); rep(i,n) scanf("%d",&a[i]); string s; cin>>s; lint sum[30][2]={}; rep(d,30){ sum[d][0]=0; int x; rep(j,2){ x=j; rep(i,n){ if(s[i]=='0'){ // and if(x==1 && (a[i]>>d&1)==0) sum[d][j]+=1LL<<d, x=0; } else{ // or if(x==0 && (a[i]>>d&1)==1) sum[d][j]+=1LL<<d, x=1; } } } } rep(_,q){ int t; scanf("%d",&t); lint ans=0; rep(d,30) ans+=sum[d][t>>d&1]; printf("%lld\n",ans); } return 0; }