結果

問題 No.387 ハンコ
ユーザー eitaho
提出日時 2016-07-10 12:43:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 884 ms / 5,000 ms
コード長 1,388 bytes
コンパイル時間 893 ms
コンパイル使用メモリ 96,820 KB
実行使用メモリ 8,576 KB
最終ジャッジ日時 2024-10-13 10:07:13
合計ジャッジ時間 9,313 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <climits>
#include <numeric>
#include <functional>
#include <time.h>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)a; i <= (int)b; i++)
template<class T> void checkmin(T &a, T b) { if (b < a) a = b; }
template<class T> void checkmax(T &a, T b) { if (b > a) a = b; }
const int MaxN = (int)1e5;
const int MaxVal = (int)1e5;
const int MaxLen = MaxN * 2;
int N;
int A[MaxN], B[MaxN];
vector<vector<int>> positions(MaxVal + 1);
void solve() {
bitset<MaxLen> all;
bitset<MaxLen> mask;
rep(i, N) positions[A[i]].push_back(i);
rep(i, N) if (B[i]) mask.set(i);
rep(color, MaxVal + 1) if (positions[color].size() > 0) {
bitset<MaxLen> curr;
for (int at : positions[color]) curr |= mask << at;
all ^= curr;
}
rep(i, N * 2 - 1) printf(all[i] ? "ODD\n" : "EVEN\n");
}
int main() {
scanf("%d", &N);
rep(i, N) scanf("%d", &A[i]);
rep(i, N) scanf("%d", &B[i]);
solve();
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0