結果
問題 | No.230 Splarraay スプラレェーイ |
ユーザー | 0w1 |
提出日時 | 2017-04-27 20:31:34 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,417 ms / 5,000 ms |
コード長 | 848 bytes |
コンパイル時間 | 1,703 ms |
コンパイル使用メモリ | 168,532 KB |
実行使用メモリ | 4,376 KB |
最終ジャッジ日時 | 2023-10-11 16:09:46 |
合計ジャッジ時間 | 12,788 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,368 KB |
testcase_01 | AC | 1 ms
4,372 KB |
testcase_02 | AC | 2 ms
4,368 KB |
testcase_03 | AC | 2 ms
4,368 KB |
testcase_04 | AC | 2 ms
4,368 KB |
testcase_05 | AC | 8 ms
4,372 KB |
testcase_06 | AC | 71 ms
4,368 KB |
testcase_07 | AC | 8 ms
4,372 KB |
testcase_08 | AC | 32 ms
4,372 KB |
testcase_09 | AC | 653 ms
4,368 KB |
testcase_10 | AC | 1,157 ms
4,372 KB |
testcase_11 | AC | 298 ms
4,376 KB |
testcase_12 | AC | 652 ms
4,372 KB |
testcase_13 | AC | 96 ms
4,372 KB |
testcase_14 | AC | 1,417 ms
4,368 KB |
testcase_15 | AC | 1,368 ms
4,368 KB |
testcase_16 | AC | 1,275 ms
4,368 KB |
testcase_17 | AC | 1,270 ms
4,372 KB |
testcase_18 | AC | 1,073 ms
4,368 KB |
testcase_19 | AC | 524 ms
4,372 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; const int MAXN = int( 1e5 ); int N; int Q; signed main() { ios::sync_with_stdio( 0 ); cin >> N; cin >> Q; bitset< MAXN > tea[ 2 ], mask; long long ans[ 2 ] = { 0, 0 }; for( int qi = 0; qi < Q; ++qi ) { int x, l, r; cin >> x >> l >> r; mask.reset(); mask.flip(); mask >>= MAXN - ( r - l + 1 ); mask <<= l; if( x == 0 ) { int ca = ( mask & tea[ 0 ] ).count(); int cb = ( mask & tea[ 1 ] ).count(); if( ca == cb ) continue; if( ca > cb ) { ans[ 0 ] += ca; } else { ans[ 1 ] += cb; } } else { tea[ x - 1 ] |= mask; mask.flip(); tea[ x - 1 ^ 1 ] &= mask; } } ans[ 0 ] += tea[ 0 ].count(); ans[ 1 ] += tea[ 1 ].count(); cout << ans[ 0 ] << " " << ans[ 1 ] << endl; return 0; }