結果
問題 | No.387 ハンコ |
ユーザー |
![]() |
提出日時 | 2016-07-04 18:21:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,827 bytes |
コンパイル時間 | 1,164 ms |
コンパイル使用メモリ | 93,420 KB |
最終ジャッジ日時 | 2025-01-26 13:20:38 |
合計ジャッジ時間 | 2,176 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:60:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 60 | int N; scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:63:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 63 | int a; scanf("%d", &a); | ~~~~~^~~~~~~~~~ main.cpp:67:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 67 | int b; scanf("%d", &b); | ~~~~~^~~~~~~~~~ In file included from /usr/include/c++/13/string:43, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from main.cpp:9: /usr/include/c++/13/bits/allocator.h: In destructor ‘std::_Vector_base<std::vector<int>, std::allocator<std::vector<int> > >::_Vector_impl::~_Vector_impl()’: /usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::vector<int>]’: target specific option mismatch 184 | ~allocator() _GLIBCXX_NOTHROW { } | ^ In file included from /usr/include/c++/13/vector:66, from main.cpp:10: /usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here 133 | struct _Vector_impl | ^~~~~~~~~~~~
ソースコード
#pragma GCC optimize ("O3") #pragma GCC target ("avx", "avx2") #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; const int X = 64; const int N_MAX = 1e5; const int M = (N_MAX + X - 1) / X; void lshift_or(u64* a, u64* b, int s) { int q = s / X; int r = s % X; if (r == 0) { rep(i, M) a[i + q] |= b[i]; } else { a[q] |= b[0] << r; rep(i, 1, M) { a[q + i] |= (b[i] << r) | (b[i - 1] >> (X - r)); } a[q + M] |= b[M - 1] >> (X - r); } } void set_bit(u64* a, int i) { a[i / X] |= u64(1) << (i % X); } bool get_bit(u64* a, int i) { return a[i / X] & (u64(1) << (i % X)); } void solve() { static u64 A[2 * M], B[M], C[2 * M]; int N; scanf("%d", &N); vector<vector<int>> As(N_MAX); rep(i, N) { int a; scanf("%d", &a); As[a - 1].push_back(i); } rep(i, N) { int b; scanf("%d", &b); if (b) set_bit(B, i); } rep(i, N_MAX) if (As[i].size()) { memset(A, 0, sizeof(A)); for (auto&& a : As[i]) lshift_or(A, B, a); rep(i, 2 * M) C[i] ^= A[i]; } rep(i, 2 * N - 1) { puts(get_bit(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; }