結果
| 問題 | No.2160 みたりのDominator |
| コンテスト | |
| ユーザー |
hotman78
|
| 提出日時 | 2022-12-04 19:53:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,588 bytes |
| 記録 | |
| コンパイル時間 | 2,309 ms |
| コンパイル使用メモリ | 200,736 KB |
| 最終ジャッジ日時 | 2025-02-09 05:02:08 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 15 WA * 2 RE * 47 TLE * 29 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/scc>
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<int(n);++i)
using lint=long long;
int main(){
array<int,3>n;
array<int,4>n2;
int m,ns=0;
rep(i,3)cin>>n[i];
rep(i,3)ns+=n[i];
n2[0]=0;
rep(i,3)n2[i+1]=n2[i]+n[i];
cin>>m;
vector<int>u(m),v(m),st;
rep(i,m){
cin>>u[i]>>v[i];
u[i]--;v[i]--;
}
lint ans=0;
assert((n[0]+1)*(n[1]+1)*(n[2]+1)*m<10000000);
rep(p,n[0]+1)rep(q,n[1]+1)rep(r,n[2]+1){
array<int,3>sel={p,q,r};
bool ok=1;
rep(i,m){
if(u[i]>v[i])swap(u[i],v[i]);
if(u[i]==ns){
cout<<0<<endl;
return 0;
}
if(v[i]==ns){
rep(s,3){
if(n2[s]<=u[i]&&u[i]<n2[s+1]){
if(u[i]<=(n2[s]+sel[s])){
ok=0;
}
}
}
}else if(v[i]==ns+1){
rep(s,3){
if(n2[s]<=u[i]&&u[i]<n2[s+1]){
if(u[i]>(n2[s]+sel[s])){
ok=0;
}
}
}
}
rep(s,3)rep(t,3){
if(n2[s]<=u[i]&&u[i]<n2[s+1]&&n2[t]<=v[i]&&v[i]<n2[t+1]){
if((u[i]<(n2[s]+sel[s]))^(v[i]<(n2[t]+sel[t]))){
ok=0;
}
}
}
}
if(ok)ans++;
}
cout<<ans<<endl;
}
hotman78