結果
問題 | No.1074 増殖 |
ユーザー |
|
提出日時 | 2020-06-05 21:58:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 766 bytes |
コンパイル時間 | 676 ms |
コンパイル使用メモリ | 80,972 KB |
実行使用メモリ | 7,168 KB |
最終ジャッジ日時 | 2024-12-17 14:46:08 |
合計ジャッジ時間 | 2,385 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 8 |
コンパイルメッセージ
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],-1));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;}}