結果
| 問題 |
No.3074 Divide Points Fairly
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-29 00:01:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 1,137 bytes |
| コンパイル時間 | 4,674 ms |
| コンパイル使用メモリ | 254,796 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-29 00:02:08 |
| 合計ジャッジ時間 | 7,265 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 42 |
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
#define all(x) begin(x), end(x)
template <typename T> bool chmin(T &x, T y) {
return x > y ? (x = y, true) : false;
}
template <typename T> bool chmax(T &x, T y) {
return x < y ? (x = y, true) : false;
}
struct IOST {
IOST() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(20);
}
} IOST;
unsigned int randxor(){
static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;
unsigned int t=(x^(x<<11)); x=y;y=z;z=w;
return(w=(w^(w>>19))^(t^(t>>8)));
}
int main(){
int n;
cin>>n;
vector<ll> x(n*2),y(n*2);
rep(i,0,n*2) cin>>x[i]>>y[i];
const int MAX_AB=1e5;
const ll MAX_C=2e10;
while(1){
ll a=randxor()%(MAX_AB+1);
if(randxor()&1) a*=-1;
ll b=randxor()%(MAX_AB+1);
if(randxor()&1) b*=-1;
if(a==0&&b==0) continue;
vector<ll> tmp;
rep(i,0,n*2){
tmp.push_back(a*x[i]+b*y[i]);
}
sort(tmp.begin(),tmp.end());
ll c=tmp[n-1]+1;
if(c<tmp[n]&&abs(c)<=MAX_C){
cout<<a<<" "<<b<<" "<<-c<<"\n";
return 0;
}
}
}