結果
| 問題 |
No.1121 Social Distancing in Cinema
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-22 22:58:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,272 bytes |
| コンパイル時間 | 1,469 ms |
| コンパイル使用メモリ | 135,416 KB |
| 最終ジャッジ日時 | 2025-01-12 03:31:17 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 44 TLE * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:48:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
48 | int n; scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:51:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
51 | for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &y[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int main()
{
/*
cin.tie(nullptr);
ios::sync_with_stdio(false);
*/
int n; scanf("%d", &n);
int k = (n + 89) / 90;
vector<int> x(n), y(n);
for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &y[i]);
int idx = min_element(x.begin(), x.end()) - x.begin();
set<pair<int, int>> s; for (int i = 0; i < n; i++) s.emplace(x[i], i);
vector<int> res;
res.emplace_back(idx);
s.erase(s.find({ x[idx], idx }));
while (res.size() < k) {
if (s.empty()) {
res.clear();
int idx = rnd() % n;
set<pair<int, int>> s; for (int i = 0; i < n; i++) s.emplace(y[i], i);
res.emplace_back(idx);
s.erase(s.find({ y[idx],idx }));
}
auto [t, p] = *s.begin();
s.erase(s.begin());
bool ok = true;
for (auto e : res) {
int len2 = (x[e] - x[p]) * (x[e] - x[p]) + (y[e] - y[p]) * (y[e] - y[p]);
if (len2 < 100) {
ok = false;
break;
}
}
if (ok) res.emplace_back(p);
}
cout << res.size() << "\n";
for (int i = 0; i < res.size(); i++) cout << res[i] + 1<< " \n"[i + 1 == res.size()];
return 0;
}