結果
問題 | No.2160 みたりのDominator |
ユーザー | hotman78 |
提出日時 | 2022-12-06 15:37:03 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,235 bytes |
コンパイル時間 | 2,709 ms |
コンパイル使用メモリ | 218,164 KB |
実行使用メモリ | 22,016 KB |
最終ジャッジ日時 | 2024-10-13 06:01:39 |
合計ジャッジ時間 | 16,065 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 2 ms
5,248 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
testcase_47 | RE | - |
testcase_48 | RE | - |
testcase_49 | RE | - |
testcase_50 | RE | - |
testcase_51 | RE | - |
testcase_52 | RE | - |
testcase_53 | RE | - |
testcase_54 | RE | - |
testcase_55 | RE | - |
testcase_56 | RE | - |
testcase_57 | RE | - |
testcase_58 | RE | - |
testcase_59 | RE | - |
testcase_60 | RE | - |
testcase_61 | RE | - |
testcase_62 | RE | - |
testcase_63 | RE | - |
testcase_64 | RE | - |
testcase_65 | RE | - |
testcase_66 | RE | - |
testcase_67 | RE | - |
testcase_68 | RE | - |
testcase_69 | RE | - |
testcase_70 | RE | - |
testcase_71 | RE | - |
testcase_72 | RE | - |
testcase_73 | RE | - |
testcase_74 | RE | - |
testcase_75 | RE | - |
testcase_76 | RE | - |
testcase_77 | RE | - |
testcase_78 | RE | - |
testcase_79 | RE | - |
testcase_80 | RE | - |
testcase_81 | RE | - |
testcase_82 | RE | - |
testcase_83 | RE | - |
61_evil_bias_nocross_01.txt | RE | - |
61_evil_bias_nocross_02.txt | RE | - |
61_evil_bias_nocross_03.txt | RE | - |
61_evil_bias_nocross_04.txt | RE | - |
61_evil_bias_nocross_05.txt | RE | - |
61_evil_bias_nocross_06.txt | RE | - |
61_evil_bias_nocross_07.txt | RE | - |
61_evil_bias_nocross_08.txt | RE | - |
61_evil_bias_nocross_09.txt | RE | - |
61_evil_bias_nocross_10.txt | RE | - |
61_evil_bias_nocross_11.txt | RE | - |
61_evil_bias_nocross_12.txt | RE | - |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<int(n);++i) #define all(n) (n).begin(),(n).end() using lint=long long; array<vector<lint>,3>ng; array<vector<lint>,3>ok; array<vector<lint>,3>rectx; array<vector<lint>,3>recty; array<vector<pair<lint,lint>>,3>judgex; array<vector<pair<lint,lint>>,3>judgey; lint getsum(lint p,lint q,lint r,lint s){ //cerr<<p<<" "<<q<<" "<<r<<" "<<s<<endl; //cerr<<lid<<" "<<rid<<endl; int sz=rectx[2].size(); lint ans=0; rep(i,sz-1){ //cerr<<ans<<endl; ans+=(ok[1][min(q,rectx[2][i+1])]-ok[1][max(p,rectx[2][i])]) *(ok[2][min(s,recty[2][i+1])]-ok[2][max(r,recty[2][i])]); } return ans; } int main(){ array<int,3>n; int m; rep(i,3)cin>>n[i]; cin>>m; assert(m*m<1000000); vector<lint>s(m),t(m),a(m),b(m),u(m),v(m); lint n1=n[0],n2=n[0]+n[1],n3=n[0]+n[1]+n[2]; rep(i,m){ cin>>u[i]>>v[i]; u[i]--;v[i]--; if(u[i]>v[i])swap(u[i],v[i]); if(u[i]==n3){ cout<<0<<endl; return 0; } if(u[i]<n1){ a[i]=u[i]+1; s[i]=0; }else if(u[i]<n2){ a[i]=u[i]-n1+1; s[i]=1; }else{ a[i]=u[i]-n2+1; s[i]=2; } if(v[i]==n3){ t[i]=s[i]; b[i]=n[a[i]]+1; }else if(v[i]==n3+1){ t[i]=s[i]; b[i]=0; }else if(v[i]<n1){ t[i]=0; b[i]=v[i]+1; }else if(v[i]<n2){ t[i]=1; b[i]=v[i]-n1+1; }else{ t[i]=2; b[i]=v[i]-n2+1; } } rep(i,3)n[i]++; //rep(i,3)cerr<<n[i]<<" \n"[i==2]; //rep(i,m)cerr<<s[i]<<" "<<t[i]<<" "<<a[i]<<" "<<b[i]<<endl; rep(i,3)ng[i].resize(n[i]+1); rep(i,3)ok[i].resize(n[i]+1); rep(i,3)rectx[i].emplace_back(0); rep(i,3)rectx[i].emplace_back(n[i==2]); rep(i,3)recty[i].emplace_back(0); rep(i,3)recty[i].emplace_back(n[2-(i==0)]); rep(i,m){ if(s[i]==t[i]){ if(a[i]>b[i])swap(a[i],b[i]); ng[a[i]][s[i]]++; ng[b[i]][t[i]]--; }else{ if(s[i]>t[i]){ swap(s[i],t[i]); swap(a[i],b[i]); } int idx=s[i]+t[i]; rectx[idx].emplace_back(a[i]); recty[idx].emplace_back(b[i]); judgex[idx].emplace_back(a[i],i); judgey[idx].emplace_back(b[i],i); } } rep(i,3)rep(j,n[i])ng[i][j+1]+=ng[i][j]; rep(i,3)rep(j,n[i])ok[i][j+1]=(ng[i][j]==0); rep(i,3)rep(j,n[i])ok[i][j+1]+=ok[i][j]; rep(i,3)sort(all(rectx[i])); rep(i,3)sort(all(recty[i])); rep(i,3)sort(all(judgex[i])); rep(i,3)sort(all(judgey[i])); // rep(i,3)assert(rectx[i].size()==recty[i].size()); //rep(i,3)rep(j,n[i]+1){ // cout<<ok[i][j]<<" \n"[j==n[i]]; //} int id1=0,id2=0; lint ans=0; rep(i,n[0]-1){ if(ng[0][i])continue; while(i>=rectx[0][id1+1])id1++; while(i>=rectx[1][id2+1])id2++; ans+=getsum(recty[0][id1],recty[0][id1+1],recty[1][id2],recty[1][id2+1]); //cerr<<ans<<endl; } cout<<ans<<endl; /**/}