結果
| 問題 |
No.1121 Social Distancing in Cinema
|
| コンテスト | |
| ユーザー |
Shun_PI
|
| 提出日時 | 2020-07-22 22:19:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,213 bytes |
| コンパイル時間 | 1,837 ms |
| コンパイル使用メモリ | 177,112 KB |
| 実行使用メモリ | 7,552 KB |
| 最終ジャッジ日時 | 2024-06-22 18:49:29 |
| 合計ジャッジ時間 | 4,652 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 46 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int N;
cin >> N;
//N = 250000;
int K = (N-1) / 90 + 1;
vector<vector<int>> b(500, vector<int>(500));
REP(i, N) {
int X, Y;
cin >> X >> Y;
//X = i/500 + 1; Y = i%500 + 1;
b[X-1][Y-1] = i+1;
}
vector<vector<int>> b2(b);
vector<vector<int>> b3(b);
vector<vector<int>> b4(b);
vector<int> ans;
vector<int> delsize = {10, 10, 10, 10, 10, 9, 8, 8, 6, 5};
REP(i, 500) REP(j, 500) {
if(b[i][j] > 0) {
ans.push_back(b[i][j]);
REP(k, 10) REP(l, delsize[k]) if(i+k < 500 && j+l < 500) b[i+k][j+l] = 0;
REP(k, 10) REP(l, delsize[k]) if(i+k < 500 && j-l >= 0) b[i+k][j-l] = 0;
}
}
//cout << K << "\n";
if(ans.size() < K) {
ans.clear();
REP(j, 500) REP(i, 500) {
if(b2[i][j] > 0) {
ans.push_back(b2[i][j]);
REP(k, 10) REP(l, delsize[k]) if(i+k < 500 && j+l < 500) b2[i+k][j+l] = 0;
REP(k, 10) REP(l, delsize[k]) if(i-k >= 0 && j+l < 500) b2[i-k][j+l] = 0;
}
}
}
if(ans.size() < K) {
ans.clear();
REP(i, 1000) REP(j, 500) {
if(i-j >= 500 || i-j < 0) continue;
if(b3[i-j][j] > 0) {
ans.push_back(b3[i-j][j]);
REP(k, 10) REP(l, delsize[k]) if(i-j-k >= 0 && j+l < 500) b3[i-j-k][j+l] = 0;
REP(k, 10) REP(l, delsize[k]) if(i-j-k >= 0 && j-l >= 0) b3[i-j-k][j-l] = 0;
REP(k, 10) REP(l, delsize[k]) if(i-j+k < 500 && j+l < 500) b3[i-j+k][j+l] = 0;
REP(k, 10) REP(l, delsize[k]) if(i-j+k < 500 && j-l >= 0) b3[i-j+k][j-l] = 0;
}
}
}
cout << ans.size() << "\n";
REP(i, ans.size()) cout << ans[i] << (i!=ans.size()-1 ? " " : "");
cout << "\n";
}
Shun_PI