結果

問題 No.202 1円玉投げ
ユーザー 古寺いろは古寺いろは
提出日時 2015-05-03 23:33:58
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 817 bytes
コンパイル時間 1,252 ms
コンパイル使用メモリ 150,964 KB
実行使用メモリ 8,808 KB
最終ジャッジ日時 2023-08-23 21:31:55
合計ジャッジ時間 23,686 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1,394 ms
8,808 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
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 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 8 ms
4,376 KB
testcase_27 AC 5 ms
4,376 KB
testcase_28 AC 5 ms
4,376 KB
testcase_29 AC 6 ms
4,376 KB
testcase_30 AC 6 ms
4,380 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int sy[20030];
int sx[20030];

int main() {
	int N;
	cin >> N;
	vector<unsigned int> x(N), y(N);

	for (int i = 0; i < 20030; i++)
	{
		sy[i] = 100030;
		sx[i] = 100030;
	}

	for (int i = 0; i < N; i++)
	{
		cin >> x[i] >> y[i];
		sy[y[i]] = i + 1;
		sx[x[i]] = i + 1;
	}

	int ans = 0;
	set<unsigned int> s;

	for (int i = 0; i < N; i++)
	{
		bool flag = true;
		for (int dy = -20; dy <= 20 && flag; dy++)
		{
			for (int dx = -20; dx <= 20 && flag; dx++)
			{
				if (dy*dy + dx*dy >= 400) continue;
				int Y = y[i] + dy;
				int X = x[i] + dx;
				if (sy[Y] >= i + 1 && sx[X] >= i + 1) continue;
				if (s.count(Y * 20001 + X)){
					flag = false;
					break;
				}
			}
		}
		if (flag){
			ans++;
			s.insert(y[i] * 20001 + x[i]);
		}
	}
	cout << ans << endl;
	
} 
0