結果

問題 No.387 ハンコ
ユーザー beetbeet
提出日時 2018-11-25 21:56:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,027 ms / 5,000 ms
コード長 763 bytes
コンパイル時間 2,136 ms
コンパイル使用メモリ 205,028 KB
実行使用メモリ 8,252 KB
最終ジャッジ日時 2023-08-26 18:55:50
合計ジャッジ時間 12,862 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,027 ms
8,232 KB
testcase_01 AC 1,027 ms
8,252 KB
testcase_02 AC 1,003 ms
6,796 KB
testcase_03 AC 1,003 ms
6,760 KB
testcase_04 AC 474 ms
6,384 KB
testcase_05 AC 719 ms
7,260 KB
testcase_06 AC 898 ms
7,852 KB
testcase_07 AC 993 ms
6,964 KB
testcase_08 AC 990 ms
7,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  vector<int> a(n),b(n);
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++) cin>>b[i];
  const int MAX = 1e5 + 100;
  vector<vector<int> > vs(MAX);
  for(int i=0;i<n;i++) vs[a[i]].emplace_back(i);

  using BS = bitset<MAX*2>;
  BS ans(0),ext(0);
  for(int i=0;i<n;i++) ext[i]=b[i];
    
  for(int i=0;i<MAX;i++){
    BS res(0);
    for(int x:vs[i]) res|=ext<<x;
    ans^=res;
  }
  
  for(int i=0;i<n*2-1;i++)
    cout<<(ans[i]?"ODD":"EVEN")<<"\n";
  cout<<flush;
  return 0;
}
0