結果
問題 | No.961 Vibrant Fillumination |
ユーザー | Pachicobue |
提出日時 | 2019-10-21 17:34:10 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,076 bytes |
コンパイル時間 | 806 ms |
コンパイル使用メモリ | 80,968 KB |
実行使用メモリ | 331,392 KB |
最終ジャッジ日時 | 2024-06-10 20:20:59 |
合計ジャッジ時間 | 60,937 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | AC | 1,162 ms
331,264 KB |
testcase_03 | AC | 1,203 ms
331,392 KB |
testcase_04 | AC | 1,094 ms
331,092 KB |
testcase_05 | AC | 1,128 ms
331,216 KB |
testcase_06 | AC | 1,111 ms
331,340 KB |
testcase_07 | AC | 1,080 ms
331,104 KB |
testcase_08 | AC | 1,091 ms
331,220 KB |
testcase_09 | AC | 1,136 ms
331,220 KB |
testcase_10 | AC | 1,514 ms
331,208 KB |
testcase_11 | AC | 1,539 ms
331,208 KB |
testcase_12 | AC | 1,432 ms
331,264 KB |
testcase_13 | AC | 1,408 ms
331,212 KB |
testcase_14 | AC | 1,414 ms
331,204 KB |
testcase_15 | AC | 1,339 ms
331,208 KB |
testcase_16 | AC | 1,417 ms
331,204 KB |
testcase_17 | AC | 1,392 ms
331,232 KB |
testcase_18 | AC | 1,406 ms
331,208 KB |
testcase_19 | AC | 1,403 ms
331,172 KB |
testcase_20 | AC | 1,415 ms
331,208 KB |
testcase_21 | AC | 1,370 ms
331,204 KB |
testcase_22 | AC | 1,383 ms
331,208 KB |
testcase_23 | AC | 1,400 ms
331,208 KB |
testcase_24 | AC | 1,370 ms
331,200 KB |
testcase_25 | AC | 1,428 ms
331,332 KB |
testcase_26 | AC | 914 ms
331,080 KB |
testcase_27 | AC | 978 ms
331,220 KB |
testcase_28 | AC | 973 ms
331,200 KB |
testcase_29 | AC | 1,055 ms
331,208 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 3 ms
6,940 KB |
testcase_34 | AC | 1,236 ms
331,208 KB |
testcase_35 | AC | 1,156 ms
331,204 KB |
testcase_36 | AC | 1,204 ms
331,200 KB |
testcase_37 | AC | 1,180 ms
331,204 KB |
testcase_38 | AC | 1,147 ms
331,224 KB |
testcase_39 | AC | 1,161 ms
331,208 KB |
testcase_40 | AC | 1,144 ms
331,204 KB |
testcase_41 | AC | 1,160 ms
331,204 KB |
testcase_42 | AC | 1,176 ms
331,204 KB |
testcase_43 | AC | 1,163 ms
331,204 KB |
testcase_44 | AC | 1,169 ms
331,080 KB |
testcase_45 | AC | 1,201 ms
331,204 KB |
testcase_46 | AC | 1,192 ms
331,216 KB |
testcase_47 | AC | 1,144 ms
331,212 KB |
testcase_48 | AC | 1,143 ms
331,212 KB |
testcase_49 | AC | 1,165 ms
331,208 KB |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using ull = unsigned long long; using usize = std::size_t; constexpr usize NMAX = 50000; constexpr usize LMAX = 2 * NMAX; ull h[NMAX + 1]; usize a[NMAX + 1], b[NMAX + 1], c[NMAX + 1], d[NMAX + 1], e[NMAX + 1]; int lr[LMAX + 1], du[LMAX + 1]; constexpr usize BS = 1000; constexpr usize BN = (LMAX + BS) / BS; ull hashs[BN][BN]; std::vector<usize> cs[BN][BN], cnt[BN][BN]; usize color_cnt[NMAX + 1]; ull hash; int main() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false); usize N; std::cin >> N; for (usize i = 1; i <= N; i++) { std::cin >> h[i]; } const usize L = 2 * N; for (usize i = 1; i <= N; i++) { std::cin >> a[i] >> b[i] >> c[i] >> d[i] >> e[i]; lr[++a[i]] = du[++b[i]] = int(i), lr[++c[i]] = du[++d[i]] = -int(i); } for (usize x = 0; x < L; x++) { for (usize yn = 0; yn < BN; yn++) { const usize xind = (usize)std::abs(lr[x + 1]); if (xind != 0) { cs[x / BS][yn].push_back(e[xind]); } } } for (usize xn = 0; xn < BN; xn++) { for (usize y = 0; y < L; y++) { const usize yind = (usize)std::abs(du[y + 1]); if (yind != 0) { cs[xn][y / BS].push_back(e[yind]); } } } auto von = [&](const usize x, const usize y) { return b[(usize)std::abs(lr[x])] <= y and y < d[(usize)std::abs(lr[x])]; }; auto hon = [&](const usize x, const usize y) { return a[(usize)std::abs(du[y])] <= x and x < c[(usize)std::abs(du[y])]; }; auto add_film = [&](const usize i) { const usize c = e[i]; if (color_cnt[c]++ == 0) { hash ^= h[c]; } }; auto del_film = [&](const usize i) { const usize c = e[i]; if (--color_cnt[c] == 0) { hash ^= h[c]; } }; auto add_del_film = [&](const int i) { if (i > 0) { add_film(usize(i)); } if (i < 0) { del_film(usize(-i)); } }; for (usize i = 0; i < BN; i++) { hash = 0, std::fill(color_cnt, color_cnt + N + 1, 0); usize x = i * BS, y = 0; for (usize j = 0; j < BN; j++) { for (const usize ci : cs[i][j]) { cnt[i][j].push_back(color_cnt[ci]); } hashs[i][j] = hash; const usize ny = std::min((j + 1) * BS, L); for (; y < ny; y++) { if (hon(x, y + 1)) { add_del_film(du[y + 1]); } } } } usize Q; std::cin >> Q; for (usize i = 0, p, q; i < Q; i++) { std::cin >> p >> q, p++, q++; const usize xi = p / BS, yi = q / BS; usize x = xi * BS, y = yi * BS; hash = hashs[xi][yi]; for (usize i = 0; i < cs[xi][yi].size(); i++) { const usize ci = cs[xi][yi][i]; color_cnt[ci] = cnt[xi][yi][i]; } for (; x < p; x++) { if (von(x + 1, y)) { add_del_film(lr[x + 1]); } } for (; y < q; y++) { if (hon(x, y + 1)) { add_del_film(du[y + 1]); } } std::cout << hash << "\n"; } return 0; }