結果
問題 | No.2160 みたりのDominator |
ユーザー | vjudge1 |
提出日時 | 2025-01-03 13:44:31 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 2,210 bytes |
コンパイル時間 | 2,435 ms |
コンパイル使用メモリ | 196,612 KB |
実行使用メモリ | 53,468 KB |
最終ジャッジ日時 | 2025-01-03 13:44:49 |
合計ジャッジ時間 | 13,469 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 6 ms
29,172 KB |
testcase_01 | AC | 11 ms
53,468 KB |
testcase_02 | AC | 5 ms
29,048 KB |
testcase_03 | AC | 6 ms
26,312 KB |
testcase_04 | AC | 7 ms
26,312 KB |
testcase_05 | AC | 6 ms
26,316 KB |
testcase_06 | AC | 5 ms
26,436 KB |
testcase_07 | AC | 6 ms
24,272 KB |
testcase_08 | AC | 5 ms
22,352 KB |
testcase_09 | AC | 5 ms
22,100 KB |
testcase_10 | AC | 5 ms
22,104 KB |
testcase_11 | AC | 6 ms
22,104 KB |
testcase_12 | AC | 5 ms
22,224 KB |
testcase_13 | AC | 5 ms
22,100 KB |
testcase_14 | AC | 7 ms
22,100 KB |
testcase_15 | AC | 5 ms
22,228 KB |
testcase_16 | AC | 5 ms
22,224 KB |
testcase_17 | AC | 5 ms
22,096 KB |
testcase_18 | AC | 6 ms
22,096 KB |
testcase_19 | AC | 6 ms
22,356 KB |
testcase_20 | AC | 5 ms
22,224 KB |
testcase_21 | AC | 5 ms
22,228 KB |
testcase_22 | AC | 5 ms
22,104 KB |
testcase_23 | AC | 5 ms
26,312 KB |
testcase_24 | AC | 6 ms
26,188 KB |
testcase_25 | AC | 6 ms
26,312 KB |
testcase_26 | AC | 6 ms
26,440 KB |
testcase_27 | AC | 5 ms
26,180 KB |
testcase_28 | AC | 6 ms
26,436 KB |
testcase_29 | AC | 6 ms
26,184 KB |
testcase_30 | AC | 6 ms
26,308 KB |
testcase_31 | AC | 6 ms
26,188 KB |
testcase_32 | AC | 5 ms
26,312 KB |
testcase_33 | AC | 5 ms
22,220 KB |
testcase_34 | AC | 12 ms
31,580 KB |
testcase_35 | AC | 5 ms
19,912 KB |
testcase_36 | AC | 5 ms
22,224 KB |
testcase_37 | AC | 7 ms
26,188 KB |
testcase_38 | AC | 6 ms
24,140 KB |
testcase_39 | AC | 6 ms
24,268 KB |
testcase_40 | AC | 15 ms
26,924 KB |
testcase_41 | AC | 16 ms
31,272 KB |
testcase_42 | AC | 10 ms
22,580 KB |
testcase_43 | AC | 12 ms
22,744 KB |
testcase_44 | AC | 13 ms
26,900 KB |
testcase_45 | AC | 14 ms
33,196 KB |
testcase_46 | AC | 13 ms
27,176 KB |
testcase_47 | AC | 10 ms
28,796 KB |
testcase_48 | AC | 11 ms
22,804 KB |
testcase_49 | AC | 12 ms
29,332 KB |
testcase_50 | AC | 13 ms
29,100 KB |
testcase_51 | AC | 10 ms
22,820 KB |
testcase_52 | AC | 13 ms
29,032 KB |
testcase_53 | AC | 14 ms
23,232 KB |
testcase_54 | AC | 12 ms
28,644 KB |
testcase_55 | AC | 27 ms
34,632 KB |
testcase_56 | AC | 27 ms
32,456 KB |
testcase_57 | AC | 27 ms
34,380 KB |
testcase_58 | AC | 29 ms
30,408 KB |
testcase_59 | AC | 27 ms
34,504 KB |
testcase_60 | AC | 26 ms
34,380 KB |
testcase_61 | AC | 27 ms
34,504 KB |
testcase_62 | AC | 30 ms
36,552 KB |
testcase_63 | AC | 26 ms
34,508 KB |
testcase_64 | AC | 25 ms
34,376 KB |
testcase_65 | AC | 16 ms
32,456 KB |
testcase_66 | AC | 15 ms
30,412 KB |
testcase_67 | AC | 17 ms
32,588 KB |
testcase_68 | AC | 28 ms
38,600 KB |
testcase_69 | AC | 19 ms
30,276 KB |
testcase_70 | AC | 28 ms
36,552 KB |
testcase_71 | AC | 14 ms
30,404 KB |
testcase_72 | AC | 22 ms
36,684 KB |
testcase_73 | AC | 26 ms
34,504 KB |
testcase_74 | AC | 26 ms
34,376 KB |
testcase_75 | AC | 9 ms
28,360 KB |
testcase_76 | AC | 9 ms
28,228 KB |
testcase_77 | AC | 17 ms
32,456 KB |
testcase_78 | AC | 20 ms
34,376 KB |
testcase_79 | AC | 8 ms
30,412 KB |
testcase_80 | AC | 8 ms
26,312 KB |
testcase_81 | AC | 10 ms
30,408 KB |
testcase_82 | AC | 11 ms
30,408 KB |
testcase_83 | AC | 13 ms
32,652 KB |
61_evil_bias_nocross_01.txt | AC | 14 ms
33,324 KB |
61_evil_bias_nocross_02.txt | AC | 15 ms
28,968 KB |
61_evil_bias_nocross_03.txt | AC | 10 ms
26,752 KB |
61_evil_bias_nocross_04.txt | TLE | - |
61_evil_bias_nocross_05.txt | AC | 13 ms
24,964 KB |
61_evil_bias_nocross_06.txt | AC | 15 ms
25,120 KB |
61_evil_bias_nocross_07.txt | AC | 10 ms
28,976 KB |
61_evil_bias_nocross_08.txt | AC | 12 ms
31,084 KB |
61_evil_bias_nocross_09.txt | AC | 13 ms
25,688 KB |
61_evil_bias_nocross_10.txt | TLE | - |
61_evil_bias_nocross_11.txt | AC | 12 ms
22,944 KB |
61_evil_bias_nocross_12.txt | AC | 14 ms
35,944 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e6+5; char buf[1<<23],*p1=buf,*p2=buf; #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?EOF:*p1++) template<class rd> void read(rd &x){ char c=getchar(); for(;c<48||c>57;c=getchar()); for(x=0;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48); } int n1,n2,n3,m,S,T; int s[3][N],ln[3],pr[3][N],su[3][N]; long long ans; pair<int,int>id(int x){ if(x<=n1)return {0,x}; if(x<=n2+n1)return {1,x-n1}; return {2,x-n1-n2}; } struct node{ int l,r,ct; }a1[N],a2[N]; int main(){ read(n1),read(n2),read(n3),read(m); S=n1+n2+n3+1,T=S+1; ln[0]=n1,ln[1]=n2,ln[2]=n3; for(int i=0;i<3;++i)for(int j=0;j<=T;++j)pr[i][j]=-1,su[i][j]=N; for(int i=1,x,y;i<=m;++i){ read(x),read(y); if(x>y)swap(x,y); if(x==S)return puts("0"),0; auto [a,b]=id(x); if(y==S||y==T){ if(y==S)++s[a][0],--s[a][b]; else ++s[a][b]; continue; } auto [c,d]=id(y); if(a==c){ ++s[a][b]; --s[a][d]; continue; } if(!a)pr[c-1][b]=max(pr[c-1][b],d),su[c-1][b]=min(su[c-1][b],d); else pr[2][b]=max(pr[2][b],d),su[2][b]=min(su[2][b],d); } for(int i=0;i<3;++i){ for(int j=1;j<=T;++j)pr[i][j]=max(pr[i][j],pr[i][j-1]); for(int j=T-1;~j;--j)su[i][j]=min(su[i][j],su[i][j+1]); } for(int i=0;i<3;++i)for(int j=1;j<=ln[i];++j)s[i][j]+=s[i][j-1]; for(int i=0,j;j=i,i<=ln[0];i=j+1){ if(pr[0][i]>=su[0][i+1])continue; int l=pr[0][i],r=su[0][i+1]-1; while(j<ln[0]&&pr[0][j+1]==l)++j; l=max(0,l),r=min(ln[1],r); int c1=0,c2=0; for(int k=i;k<=j;++k){ if(s[0][k]||pr[1][k]>=su[1][k+1])continue; int L=pr[1][k],R=su[1][k+1]-1; if(c1&&a1[c1].l==L)++a1[c1].ct; else a1[++c1]={L,R,1}; } for(int k=l;k<=r;++k){ if(s[1][k]||pr[2][k]>=su[2][k+1])continue; int L=pr[2][k],R=su[2][k+1]-1; if(c2&&a2[c2].l==L)++a2[c2].ct; else a2[++c2]={L,R,1}; } if(!c1||!c2)continue; int o=max(0,max(a1[1].l,a2[1].l)),p1=1,p2=1; while(p1<=c1&&o>a1[p1].r)++p1; while(p2<=c2&&o>a2[p2].r)++p2; while(o<=ln[2]&&p1<=c1&&p2<=c2){ if(!s[2][o]&&o>=a1[p1].l&&o>=a2[p2].l)ans+=1ll*a1[p1].ct*a2[p2].ct; if(o==a1[p1].r)++p1; if(o==a2[p2].r)++p2; ++o; } } printf("%lld\n",ans); return 0; }