結果
問題 | No.1074 増殖 |
ユーザー |
|
提出日時 | 2020-06-05 21:59:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 772 bytes |
コンパイル時間 | 787 ms |
コンパイル使用メモリ | 81,032 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-17 14:47:40 |
合計ジャッジ時間 | 2,480 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 5 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 8 | main() | ^~~~
ソースコード
#include<iostream>#include<algorithm>#include<vector>#include<set>using namespace std;int N;set<pair<int,int> >S[4];main(){for(int i=0;i<4;i++){S[i].insert(make_pair(0,1e5));S[i].insert(make_pair(1e5,0));}cin>>N;for(;N--;){int Xa,Ya,Xb,Yb;cin>>Xa>>Ya>>Xb>>Yb;int X[4]={Xb,-Xa,-Xa,Xb};int Y[4]={Yb,Yb,-Ya,-Ya};int ans=0;for(int i=0;i<4;i++){set<pair<int,int> >::iterator it=S[i].upper_bound(make_pair(X[i],(int)2e5));if(it->second>Y[i])continue;int py=it->second;it--;int pre=X[i];while(true){ans+=(Y[i]-py)*(pre-it->first);if(it->second>Y[i])break;py=it->second;pre=it->first;it=S[i].erase(it);it--;}S[i].insert(make_pair(X[i],Y[i]));}cout<<ans<<endl;}}