結果

問題 No.606 カラフルタイル
ユーザー Sebastian KingSebastian King
提出日時 2017-12-06 00:07:20
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,330 bytes
コンパイル時間 1,908 ms
コンパイル使用メモリ 158,088 KB
実行使用メモリ 7,680 KB
最終ジャッジ日時 2024-05-06 12:00:51
合計ジャッジ時間 3,513 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 35 ms
6,272 KB
testcase_18 WA -
testcase_19 AC 23 ms
5,888 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 35 ms
7,680 KB
testcase_27 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void solve(int)’:
main.cpp:29:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   29 |         scanf("%d%d%d", &n, &m, &Q);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:37:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   37 |                 scanf("%s%d%d", s, &x, &y);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

const int MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e5 + 10;

int n, m;

void prework(){

}

void read(){

}

int r[MAXN], c[MAXN], rt[MAXN], ct[MAXN];
int z[MAXN], X[MAXN], Y[MAXN];
int ans[MAXN], visr[MAXN], visc[MAXN];

void solve(int casi){
//	cout << "Case #" << casi << ": ";
	int Q;
	scanf("%d%d%d", &n, &m, &Q);
	for (int i = 1; i <= n; i++){
		r[i] = 1, rt[i] = 0;
		c[i] = 1, ct[i] = 0;
	}
	for (int i = 1; i <= Q; i++){
		char s[10];
		int x, y;
		scanf("%s%d%d", s, &x, &y);
		if (s[0] == 'R'){
			r[x] = y;
			rt[x] = i;
		}
		else{
			c[x] = y;
			ct[x] = i;
		}
		z[i] = s[0]=='R';
		X[i] = x;
		Y[i] = y;
	}
	for (int i = 1; i <= m; i++)
		ans[i] = 0;
	for (int i = 1; i <= n; i++)
		visr[i] = visc[i] = 0;
	int R = n, C = n;
	for (int i = Q; i >= 1; i--){
		if (z[i] == 1){
			if (visr[X[i]])
				;
			else
				ans[Y[i]] += C;
			R--;
			visr[X[i]] = 1;
		}
		else{
			if (visc[X[i]])
				;
			else
				ans[Y[i]] += R;
			C--;
			visc[X[i]] = 1;
		}
	}
	for (int i = 1; i <= m; i++)
		printf("%d\n", ans[i]);
}

void printans(){

}

int main(){
//	std::ios::sync_with_stdio(false);
	prework();
	int T = 1;
//	cin>>T;
	for(int i = 1; i <= T; i++){
		read();
		solve(i);
		printans();
	}
	return 0;
}

0