結果

問題 No.230 Splarraay スプラレェーイ
ユーザー tails
提出日時 2015-06-19 23:13:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 414 bytes
コンパイル時間 1,171 ms
コンパイル使用メモリ 158,052 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-07 04:15:55
合計ジャッジ時間 9,629 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 TLE * 1 -- * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int N,Q;
char a[100000];
int s[3];

int main(){
	cin>>N>>Q;
	for(int i=0;i<Q;++i){
		int x,l,r;
		cin>>x>>l>>r;
		if(x){
			memset(a+l,x,r-l+1);
		}else{
			int t[3]={0,0,0};
			while(l<=r){
				++t[a[l++]];
			}
			if(t[1]>t[2])s[1]+=t[1];
			if(t[2]>t[1])s[2]+=t[2];
		}
	}
	for(int i=0;i<N;++i){
		++s[a[i]];
	}
	cout << s[1] << " " << s[2] << endl;
	return 0;

}
0