QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#427613 | #8780. Training, Round 2 | ucup-team3586# | WA | 19ms | 14788kb | C++23 | 2.1kb | 2024-06-01 14:14:17 | 2024-06-01 14:14:18 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
ll n;
ll a,b;
ll A[5005],B[5005],C[5005],D[5005];
set<int> Rs[5005],Cs[5005];
bool vis[5005][5005];
void check(int x,int y)
{
if(vis[x][y]&&!vis[x+1][y])
Cs[y].insert(x);
else
Cs[y].erase(x);
if(vis[x][y]&&!vis[x][y+1])
Rs[x].insert(y);
else
Rs[x].erase(y);
if(x&&vis[x-1][y]&&!vis[x][y])
Cs[y].insert(x-1);
else
Cs[y].erase(x-1);
if(y&&vis[x][y-1]&&!vis[x][y])
Rs[x].insert(y-1);
else
Rs[x].erase(y-1);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>a>>b;
for(int i=1;i<=n;i++)
{
cin>>A[i]>>B[i]>>C[i]>>D[i];
A[i]-=a;
B[i]-=a;
C[i]-=b;
D[i]-=b;
A[i]=max(A[i],0ll);
C[i]=max(C[i],0ll);
B[i]=min(B[i],n);
D[i]=min(D[i],n);
}
vis[0][0]=1;
Rs[0].insert(0);
Cs[0].insert(0);
for(int i=1;i<=n;i++)
{
if(A[i]>B[i]||C[i]>D[i])
continue;
for(int j=A[i];j<=B[i];j++)
{
vector<int> vec;
auto it=Rs[j].lower_bound(C[i]);
while(it!=Rs[j].end()&&*it<=D[i])
{
vis[j][*it+1]=1;
vec.pb(*it+1);
it++;
}
for(auto k:vec)
check(j,k);
}
for(int j=C[i];j<=D[i];j++)
{
vector<int> vec;
auto it=Cs[j].lower_bound(A[i]);
while(it!=Cs[j].end()&&*it<=B[i])
{
vis[*it+1][j]=1;
vec.pb(*it+1);
it++;
}
for(auto k:vec)
check(k,j);
}
}
int ans=0;
for(int i=0;i<=n;i++)
for(int j=0;j<=n;j++)
if(vis[i][j])
ans=max(ans,i+j);
cout<<ans<<'\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5804kb
input:
3 0 0 0 1 0 1 1 1 0 1 1 1 1 1
output:
3
result:
ok single line: '3'
Test #2:
score: 0
Accepted
time: 15ms
memory: 14788kb
input:
5000 801577551 932138594 801577551 801577551 932138594 932138594 801577552 801577552 932138594 932138594 801577552 801577552 932138595 932138595 801577552 801577552 932138596 932138596 801577553 801577553 932138596 932138596 801577553 801577553 932138597 932138597 801577553 801577553 932138598 93213...
output:
5000
result:
ok single line: '5000'
Test #3:
score: 0
Accepted
time: 19ms
memory: 14268kb
input:
5000 932138594 801577551 932138594 932138594 801577551 801577551 932138594 932138594 801577552 801577552 932138595 932138595 801577552 801577552 932138596 932138596 801577552 801577552 932138596 932138596 801577553 801577553 932138597 932138597 801577553 801577553 932138598 932138598 801577553 80157...
output:
5000
result:
ok single line: '5000'
Test #4:
score: -100
Wrong Answer
time: 18ms
memory: 4404kb
input:
5000 76836128 716580777 76836128 76836128 716580777 716580777 76836129 76836129 716580777 716580777 76836130 76836130 716580777 716580777 76836131 76836131 716580777 716580777 76836131 76836131 716580778 716580778 76836131 76836131 716580779 716580779 76836131 76836131 716580780 716580780 76836128 7...
output:
4995
result:
wrong answer 1st lines differ - expected: '4994', found: '4995'