結果

問題 No.387 ハンコ
ユーザー yosupotyosupot
提出日時 2016-06-22 22:32:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,070 ms / 5,000 ms
コード長 899 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 72,368 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2024-04-20 00:31:47
合計ジャッジ時間 11,386 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,059 ms
7,936 KB
testcase_01 AC 1,070 ms
7,936 KB
testcase_02 AC 1,036 ms
6,272 KB
testcase_03 AC 1,039 ms
6,272 KB
testcase_04 AC 582 ms
6,656 KB
testcase_05 AC 790 ms
7,296 KB
testcase_06 AC 941 ms
7,680 KB
testcase_07 AC 1,045 ms
6,656 KB
testcase_08 AC 1,028 ms
6,272 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
main.cpp:20:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |         scanf("%d", &a);
      |         ~~~~~^~~~~~~~~~
main.cpp:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cmath>
#include <bitset>

using namespace std;
using ll = long long;

const int MN = 100100;
vector<int> g[MN];
using B = bitset<2*MN>;
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        g[a].push_back(i);
    }
    B mp; mp.reset();
    for (int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        if (x == 1) {
            mp[i] = true;
        }
    }
    B ans; ans.reset();
    for (int i = 0; i < MN; i++) {
        B res; res.reset();
        for (int d: g[i]) {
            res |= mp << d;
        }
        ans ^= res;
    }
    for (int i = 0; i < 2*n-1; i++) {
        if (ans[i]) {
            printf("ODD\n");
        } else {
            printf("EVEN\n");
        }
    }
    return 0;
}
0