結果

問題 No.387 ハンコ
ユーザー Pachicobue
提出日時 2018-11-12 03:57:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,179 ms / 5,000 ms
コード長 716 bytes
コンパイル時間 817 ms
コンパイル使用メモリ 76,064 KB
最終ジャッジ日時 2025-01-06 16:28:14
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <bitset>
#include <vector>
constexpr uint M = 100000;
constexpr uint L = 2 * M - 1;
std::bitset<L> pos, ans;
std::vector<uint> off[M];
int main()
{
    uint N;
    std::cin >> N;
    for (uint i = 0, a; i < N; i++) { std::cin >> a, off[a - 1].push_back(i); }
    for (uint i = 0, b; i < N; i++) {
        std::cin >> b;
        if (b) { pos.set(i); }
    }
    std::bitset<L> mask;
    for (uint i = 0; i < M; i++) {
        if (off[i].empty()) { continue; }
        mask.reset();
        for (const uint o : off[i]) { mask |= (pos << o); }
        ans ^= mask;
    }
    for (uint i = 0; i < 2 * N - 1; i++) { std::cout << (ans.test(i) ? "ODD" : "EVEN") << std::endl; }
    return 0;
}
0