QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#670478 | #8780. Training, Round 2 | myloveATRI | WA | 56ms | 12072kb | C++20 | 2.1kb | 2024-10-23 21:52:50 | 2024-10-23 21:52:52 |
Judging History
answer
#include<bits/stdc++.h>
#include<queue>
#include<string.h>
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#define int long long
#define ll long long
#define ull unsigned long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define nl t[n].l
#define nr t[n].r
#define gcd __gcd
#define itn int
using namespace std;
const int maxn=1e6+50;
const int N=1e5+50;
const int inf=31525197391593473;
const int INF=2e18;
const int mod=998244353;
const double eps=1e-12;
#define pop_count __builtin_popcountll
//const ull mask = std::chrono::steady_clock::now().time_since_epoch().count();
int a[maxn],b[maxn],c[maxn],d[maxn];
int f[5005][5005];
int ma[5005];
int r[5005];
void solve()
{
int n,k1,k2;
cin>>n>>k1>>k2;
rep(i,1,n)
{
cin>>a[i]>>b[i]>>c[i]>>d[i];
}
f[0][0]=1;
rep(i,1,n)
{
vector<array<int,2>> g;
for(int j=n+2;j>=0;j--)
{
int k=ma[j];
{
if(f[j][k]&&k1+j>=a[i]&&k1+j<=b[i]&&k2+k>=c[i]&&k2+k<=d[i])
{
g.push_back({j+1,k});
g.push_back({j,k+1});
ma[j]=max(ma[j],k+1);
// ma[j+1]=max(ma[j+1],k);
}
}
}
for(int k=n+2;k>=0;k--)
{
int j=r[k];
if(f[j][k]&&k1+j>=a[i]&&k1+j<=b[i]&&k2+k>=c[i]&&k2+k<=d[i])
{
g.push_back({j+1,k});
g.push_back({j,k+1});
r[k]=max(r[k],j+1);
// r[k+1]=max(r[k+1],j);
}
}
for(auto x:g)
{
f[x[0]][x[1]]=1;
// r[x[1]]=max(r[x[1]],x[0]);
// ma[x[0]]=max(ma[x[0]],x[1]);
}
}
int ans=0;
rep(i,0,n+2)
{
rep(j,0,n+2)
{
if(f[i][j]) ans=max(i+j,ans);
}
}
cout<<ans;
}
signed main()
{
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int __=1;
srand((time(0)));
//cin>>__;
while(__--)
{
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 11916kb
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: -100
Wrong Answer
time: 56ms
memory: 12072kb
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:
4
result:
wrong answer 1st lines differ - expected: '5000', found: '4'