結果

問題 No.1121 Social Distancing in Cinema
ユーザー chocopuuchocopuu
提出日時 2020-07-22 22:48:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,184 bytes
コンパイル時間 2,956 ms
コンパイル使用メモリ 215,316 KB
実行使用メモリ 20,260 KB
最終ジャッジ日時 2023-09-05 02:55:06
合計ジャッジ時間 9,856 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
12,020 KB
testcase_01 AC 5 ms
7,344 KB
testcase_02 AC 4 ms
7,468 KB
testcase_03 AC 5 ms
7,304 KB
testcase_04 AC 5 ms
7,468 KB
testcase_05 AC 5 ms
7,300 KB
testcase_06 AC 5 ms
7,364 KB
testcase_07 AC 5 ms
7,312 KB
testcase_08 AC 5 ms
7,292 KB
testcase_09 AC 6 ms
7,348 KB
testcase_10 AC 6 ms
7,292 KB
testcase_11 AC 8 ms
7,372 KB
testcase_12 WA -
testcase_13 AC 28 ms
7,364 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;



signed main(){
	int N;
	cin >> N;
	vector<int>x(N), y(N);
	vector<vector<int>>field(500,vector<int>(500));
	vector<vector<int>>idx(500, vector<int>(500, -1));
	vector<pair<int,int>>dir;
	for(int i = -10; i < 10 + 1; i++) {
		for(int j = -10; j < 10 + 1; j++) {
			int dist = i * i + j * j;
			if(dist < 100) {
				dir.emplace_back(i, j);
			}
		}
	}
	REP(i, N) {
		cin >> x[i] >> y[i];
		--x[i]; --y[i];
		idx[x[i]][y[i]] = i;
		for(auto[X, Y] : dir) {
			int ni = x[i] + X;
			int nj = y[i] + Y;
			if(!IN(0, ni, 500) || !IN(0, nj, 500)) continue;
			field[ni][nj]++;	
		}
	}
	set<pair<int,int>>st;
	REP(i, N) {
		//out(i, field[x[i]][y[i]]);
		st.insert({-field[x[i]][y[i]], i});
	}
	while(1) {
		auto itr = st.begin();
		if(itr->first == -1) break;
		int now = itr->second;
		//out(now, -itr->first);
		int i = x[now];
		int j = y[now];
		for(auto[X, Y] : dir) {
			int ni = i + X;
			int nj = j + Y;
			if(!IN(0, ni, 500) || !IN(0, nj, 500)) continue;
			if(idx[ni][nj] != -1 && field[ni][nj]) {
				//out(ni, nj, field[ni][nj], idx[ni][nj]);;
				auto itr = st.find({-field[ni][nj], idx[ni][nj]});
				if(itr == st.end()){
					
					continue;
				}
				st.erase(itr);
				field[ni][nj]--;
				if(field[ni][nj] && (Y || X))st.insert({-field[ni][nj], idx[ni][nj]});
			}
		}
	}
	out(st.size());
	vector<int>ans;
	while(st.size()) {
		ans.emplace_back(st.begin()->second);
		st.erase(st.begin());
	}
	REP(i,ans.size())cout << ans[i] + 1 << " \n"[i+1 == ans.size()];
}
0