結果

問題 No.387 ハンコ
ユーザー Min_25Min_25
提出日時 2016-07-04 03:45:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 641 ms / 5,000 ms
コード長 1,261 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 92,200 KB
実行使用メモリ 7,808 KB
最終ジャッジ日時 2024-04-20 21:46:13
合計ジャッジ時間 6,934 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 641 ms
7,808 KB
testcase_01 AC 635 ms
7,808 KB
testcase_02 AC 522 ms
6,944 KB
testcase_03 AC 525 ms
6,940 KB
testcase_04 AC 208 ms
6,940 KB
testcase_05 AC 397 ms
7,168 KB
testcase_06 AC 534 ms
7,680 KB
testcase_07 AC 536 ms
6,940 KB
testcase_08 AC 521 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cassert>
#include <cmath>
#include <cstring>

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <tuple>
#include <bitset>

#define _rep(_1, _2, _3, _4, name, ...) name
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, c) for (int i = int(a); i < int(b); i += int(c))
#define rep(...) _rep(__VA_ARGS__, rep4, rep3, rep2, _)(__VA_ARGS__)

using namespace std;

using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f80 = long double; 

#pragma GCC optimize "O3" // enable SIMD
void solve() {
  const int M = 100000;
  static bitset<2 * M> A, B, C;
  int N; scanf("%d", &N);
  vector<vector<int>> As(M);
  rep(i, N) {
    int a; scanf("%d", &a);
    As[a - 1].push_back(i);
  }
  rep(i, N) {
    int b; scanf("%d", &b);
    if (b) B[i] = 1;
  }
  rep(i, M) if (As[i].size()) {
    A.reset();
    for (auto&& a : As[i]) A |= B << a;
    C ^= A;
  }
  rep(i, 2 * N - 1) {
    puts(C[i] ? "ODD" : "EVEN");
  }
}

int main() {
  clock_t beg = clock();
  solve();
  clock_t end = clock();
  fprintf(stderr, "%.3f sec\n", double(end - beg) / CLOCKS_PER_SEC);
  return 0;
}
0