QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#229807 | #7636. Fair Elections | ucup-team191# | WA | 0ms | 3740kb | C++14 | 1.8kb | 2023-10-28 16:57:00 | 2023-10-28 16:57:02 |
Judging History
answer
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using pii=pair<int,int>;
using vi=vector<int>;
using ll=long long;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)
const int N=10010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;
int n,a[N],b[N],c[N],x[2][N],y[2][N];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n;
for (int i=0;i<n;++i)
{
cin>>a[i]>>b[i]>>c[i];
}
for (int c1=0;c1<=n;++c1)
{
int pn3=-1,pn1=-1;
for (int c2=0;c1+c2<=n;++c2)
{
int wi,c3=n-c1-c2;
if (c1>=c2 && c1>=c3) wi=1;
else if (c2>c1 && c2>=c3) wi=2;
else wi=3;
if (wi!=3 && pn3==-1)
{
pn3=c2;
}
if (wi!=1 && pn3!=-1 && pn1==-1)
{
pn1=c2;
}
}
if (pn1==-1) pn1=n-c1+1;
x[n%2][c1]=pn3;
y[n%2][c1]=pn1;
}
for (int i=n-1;i>=0;--i)
{
int cu=i%2,ne=(i+1)%2;
for (int c1=0;c1<=i;++c1)
{
vi v={x[ne][c1+1],y[ne][c1+1],x[ne][c1],y[ne][c1]-1};
sort(all(v));
int pn3=-1,pn1=-1;
for (auto c2: v)
{
int wi=-1;
if (a[i]==1)
{
if (c2>=x[ne][c1+1] && c2<y[ne][c1+1]) wi=1;
}
if (a[i]==2)
{
if (c2+1>=y[ne][c1]) wi=2;
}
if (a[i]==3)
{
if (c2<x[ne][c1]) wi=3;
}
if (wi==-1)
{
if (b[i]==1)
{
if (c2>=x[ne][c1+1] && c2<y[ne][c1+1]) wi=1;
}
if (b[i]==2)
{
if (c2+1>=y[ne][c1]) wi=2;
}
if (b[i]==3)
{
if (c2<x[ne][c1]) wi=3;
}
}
if (wi==-1) wi=c[i];
if (wi!=3 && pn3==-1) pn3=c2;
if (wi!=1 && pn3!=-1 && pn1==-1) pn1=c2;
}
if (pn1==-1) pn1=i+1-c1;
if (pn3==-1) pn3=i+1-c1;
x[cu][c1]=pn3;
y[cu][c1]=pn1;
}
}
if (x[0][0]>0) cout<<3<<en;
else if (y[0][0]>0) cout<<1<<en;
else cout<<2<<en;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
3 3 2 1 1 2 3 2 1 3
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
5 1 2 3 2 3 1 1 3 2 3 1 2 2 1 3
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 1 2 3 3 2 1 1 2 3 1 2 3 3 2 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5 3 2 1 3 1 2 2 3 1 1 2 3 2 1 3
output:
2
result:
ok 1 number(s): "2"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
5 3 2 1 3 2 1 1 3 2 1 3 2 3 2 1
output:
3
result:
ok 1 number(s): "3"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
5 3 2 1 3 1 2 1 2 3 1 3 2 1 3 2
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
20 1 2 3 2 3 1 1 3 2 3 1 2 2 1 3 1 2 3 3 2 1 1 2 3 1 2 3 3 2 1 3 2 1 3 1 2 2 3 1 1 2 3 2 1 3 3 2 1 3 2 1 1 3 2 1 3 2 3 2 1
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
20 3 2 1 3 1 2 1 2 3 1 3 2 1 3 2 1 2 3 3 1 2 1 3 2 3 2 1 1 3 2 2 1 3 3 1 2 2 3 1 2 1 3 2 3 1 3 1 2 3 1 2 2 1 3 3 1 2 1 2 3
output:
1
result:
ok 1 number(s): "1"
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3664kb
input:
20 1 2 3 2 3 1 2 1 3 2 1 3 1 3 2 3 1 2 2 3 1 1 3 2 3 1 2 1 2 3 1 2 3 3 2 1 3 1 2 1 2 3 3 2 1 1 2 3 2 3 1 3 1 2 3 2 1 3 2 1
output:
2
result:
wrong answer 1st numbers differ - expected: '3', found: '2'