結果

問題 No.230 Splarraay スプラレェーイ
ユーザー 沙耶花沙耶花
提出日時 2021-11-16 22:41:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 618 bytes
コンパイル時間 4,076 ms
コンパイル使用メモリ 259,368 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 02:15:31
合計ジャッジ時間 14,935 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001


int main(){
	
	int N,Q;
	cin>>N>>Q;
	
	vector<int> a(N,0);
	int A=0,B=0;
	rep(_,Q){
		int x,l,r;
		scanf("%d %d %d",&x,&l,&r);
		
		
		if(x==0){
			vector<int> c(3,0);
			for(int i=l;i<=r;i++)c[a[i]]++;
			if(c[1]>c[2])A += c[1];
			if(c[1]<c[2])B += c[2];
		}
		else{
			for(int i=l;i<=r;i++)a[i] = x;
		}
	}
	
	rep(i,N){
		if(a[i]==1)A++;
		if(a[i]==2)B++;
	}
	
	cout<<A<<' '<<B<<endl;
	
	return 0;
}
0