結果

問題 No.606 カラフルタイル
ユーザー lyozlyoz
提出日時 2017-12-06 00:12:03
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 2,394 bytes
コンパイル時間 1,916 ms
コンパイル使用メモリ 203,812 KB
実行使用メモリ 5,372 KB
最終ジャッジ日時 2023-08-19 05:00:31
合計ジャッジ時間 3,750 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 14 ms
4,384 KB
testcase_17 AC 23 ms
5,140 KB
testcase_18 AC 16 ms
4,380 KB
testcase_19 AC 15 ms
4,396 KB
testcase_20 AC 24 ms
5,328 KB
testcase_21 AC 16 ms
4,576 KB
testcase_22 AC 16 ms
4,684 KB
testcase_23 AC 18 ms
4,792 KB
testcase_24 AC 22 ms
5,348 KB
testcase_25 AC 22 ms
5,372 KB
testcase_26 AC 23 ms
5,320 KB
testcase_27 AC 22 ms
5,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n,k,q;cin>>n>>k>>q&&n|k|q;){
		vector<char> as(q);
		vector<int> bs(q),cs(q);
		rep(i,q) cin>>as[i]>>bs[i]>>cs[i],bs[i]--,cs[i]--;

		vi rflg(n),cflg(n);
		int rcnt=n,ccnt=n;
		vl res(k);
		per(i,q)
			if(as[i]=='R'){
				if(!exchange(rflg[bs[i]],true)){
					res[cs[i]]+=ccnt;
					rcnt--;
				}
			}
			else{
				if(!exchange(cflg[bs[i]],true)){
					res[cs[i]]+=rcnt;
					ccnt--;
				}
			}
		res[0]+=(ll)n*n-accumulate(all(res),0ll);
		rep(i,k) cout<<res[i]<<endl;
	}
}
0