結果
問題 |
No.230 Splarraay スプラレェーイ
|
ユーザー |
![]() |
提出日時 | 2015-06-11 04:59:21 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1,494 ms / 5,000 ms |
コード長 | 963 bytes |
コンパイル時間 | 972 ms |
コンパイル使用メモリ | 81,492 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 14:13:45 |
合計ジャッジ時間 | 11,740 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> #include <set> #include <bitset> using namespace std; #define LEN 100000 int main(){ int n,q; cin >> n >> q; long long ans_a = 0; long long ans_b = 0; bitset<LEN> a; bitset<LEN> b; bitset<LEN> mask; for(int i=0; i<q; i++){ int x,l,r; cin >> x >> l >> r; mask.reset(); mask.flip(); int d = LEN - (r+1 - l); mask >>= d; mask <<= l; if(x==0){ int cnt_a = (a & mask).count(); int cnt_b = (b & mask).count(); if(cnt_a == cnt_b) continue; (cnt_a>cnt_b?ans_a:ans_b) += max(cnt_a, cnt_b); }else{ if(x==1){ a |= mask; mask.flip(); b &= mask; }else{ b |= mask; mask.flip(); a &= mask; } } } int cnt_a = a.count(); int cnt_b = b.count(); ans_a += cnt_a; ans_b += cnt_b; cout << ans_a << " " << ans_b << endl; return 0; }