結果

問題 No.387 ハンコ
ユーザー jjh20100730
提出日時 2024-10-15 21:25:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 769 ms / 5,000 ms
コード長 666 bytes
コンパイル時間 6,834 ms
コンパイル使用メモリ 196,528 KB
最終ジャッジ日時 2025-02-24 19:53:23
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,mx=0,b[N];
vector<int> ve[N];
bitset<2*N> bs,ans;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr),cout.tie(nullptr);
	cin>>n;
    for(int i=1; i<=n; i++) {
    	int a;
    	cin>>a;mx=max(mx,a);
        ve[a].push_back(i);
    }
    for(int i=1; i<=n; i++) cin>>b[i];
    for(int i=1; i<=n; i++) if(b[i]) bs[i]=1;
    for(int i=1; i<=mx; i++) {
    	if(!ve[i].size()) continue;
    	bitset<2*N> bst;
    	for(int j=0; j<ve[i].size(); j++) bst|=bs<<ve[i][j]-1;
        ans^=bst;
	}
	for(int i=1; i<=2*n-1; i++)
		if(ans[i]) cout<<"ODD"<<'\n';
		else cout<<"EVEN"<<'\n';
    return 0;
}
0