結果
| 問題 |
No.1074 増殖
|
| コンテスト | |
| ユーザー |
carrot46
|
| 提出日時 | 2020-06-05 22:46:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,693 bytes |
| コンパイル時間 | 1,792 ms |
| コンパイル使用メモリ | 184,552 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-17 16:53:02 |
| 合計ジャッジ時間 | 3,973 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 WA * 1 RE * 9 |
ソースコード
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<62);
void solve(vec &res, vec x, vec y){
const int max_x = 20005;
set<P> pts;
pts.emplace(0, N);
pts.emplace(max_x, N + 1);
x.push_back(0);
x.push_back(max_x);
y.push_back(max_x);
y.push_back(0);
rep(i,N){
auto ite = lower_bound(ALL(pts), P(x[i] + 1, -1));
if(y[ite->se] >= y[i]) continue;
bool flag = false;
while(y[ite->se] <= y[i]){
ll last_id = ite->se;
--ite;
if(x[ite->se] == x[i] && y[ite->se] >= y[i]) {
flag = true;
break;
}
res[i] += (min(x[i], x[last_id]) - x[ite->se]) * (y[i] - y[last_id]);
if(y[ite->se] <= y[i]) pts.erase(P(x[last_id], last_id));
}
if(!flag) pts.emplace(x[i], i);
}
}
int main() {
cin>>N;
mat x(2, vec(N)), y(2, vec(N));
vec res(N, 0);
rep(i,N){
rep(j,2) cin>>x[j][i]>>y[j][i];
x[0][i] *= -1;
y[0][i] *= -1;
}
rep(i,2) rep(j,2) {
solve(res, x[i], y[j]);
/*
rep(k,N){
cout<<res[k]<<' ';
}
cout<<endl;
*/
}
rep(i,N) cout<<res[i]<<endl;
}
carrot46