結果
問題 |
No.230 Splarraay スプラレェーイ
|
ユーザー |
![]() |
提出日時 | 2015-06-11 05:00:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 867 bytes |
コンパイル時間 | 645 ms |
コンパイル使用メモリ | 75,192 KB |
実行使用メモリ | 10,396 KB |
最終ジャッジ日時 | 2024-07-06 15:32:21 |
合計ジャッジ時間 | 8,932 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 TLE * 1 -- * 5 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> #include <set> #include "assert.h" using namespace std; int main(){ int n,q; cin >> n >> q; vector<int> a(n); long long ans_a = 0; long long ans_b = 0; for(int i=0; i<q; i++){ int x,l,r; cin >> x >> l >> r; if(x==0){ int cnt_a = 0; int cnt_b = 0; for(int k=l; k<=r; k++){ if(a[k]==0) continue; (a[k]==1?cnt_a:cnt_b)++; } if(cnt_a == cnt_b) continue; (cnt_a>cnt_b?ans_a:ans_b) += max(cnt_a, cnt_b); }else{ for(int k=l; k<=r; k++){ a[k] = x; } } } int cnt_a = 0; int cnt_b = 0; for(int k=0; k<n; k++){ if(a[k]==0) continue; (a[k]==1?cnt_a:cnt_b)++; } ans_a += cnt_a; ans_b += cnt_b; cout << ans_a << " " << ans_b << endl; return 0; }