結果
| 問題 |
No.230 Splarraay スプラレェーイ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-27 20:30:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,553 ms / 5,000 ms |
| コード長 | 854 bytes |
| コンパイル時間 | 1,830 ms |
| コンパイル使用メモリ | 170,900 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-13 14:52:35 |
| 合計ジャッジ時間 | 13,173 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#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 > team[ 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 & team[ 0 ] ).count();
int cb = ( mask & team[ 1 ] ).count();
if( ca == cb ) continue;
if( ca > cb ) {
ans[ 0 ] += ca;
} else {
ans[ 1 ] += cb;
}
} else {
team[ x - 1 ] |= mask;
mask.flip();
team[ x - 1 ^ 1 ] &= mask;
}
}
ans[ 0 ] += team[ 0 ].count();
ans[ 1 ] += team[ 1 ].count();
cout<< ans[ 0 ] << " " << ans[ 1 ] << endl;
return 0;
}