結果

問題 No.230 Splarraay スプラレェーイ
ユーザー tailstails
提出日時 2015-06-19 23:13:29
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 414 bytes
コンパイル時間 1,259 ms
コンパイル使用メモリ 143,968 KB
実行使用メモリ 8,776 KB
最終ジャッジ日時 2023-09-21 10:10:16
合計ジャッジ時間 10,398 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,680 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 10 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 880 ms
4,376 KB
testcase_10 AC 52 ms
4,380 KB
testcase_11 AC 205 ms
4,384 KB
testcase_12 AC 872 ms
4,380 KB
testcase_13 AC 21 ms
4,376 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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