QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#431843 | #8780. Training, Round 2 | VinnySJ | WA | 22ms | 25812kb | C++20 | 3.6kb | 2024-06-06 10:28:35 | 2024-06-06 10:28:35 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC optimize("O2")
// #pragma GCC optimize("unroll-loops")
#define pb push_back
#define del pop_back
#define ll long long
#define double long double
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int>
#define deriva_e_iguala_a return
#define fcin ios_base::sync_with_stdio(false)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define print(vec, a, b) {for(int f = a; f < b; f++)cout << vec[f] << ' '; cout << endl;}
#define printr(vec) {for(auto f: vec) cout << f << ' '; cout << endl;}
#define endl '\n'
#define f first
#define s second
using namespace std;
// using namespace __gnu_pbds;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
template<class T> using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, std::less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
//<T> -> set, pair<T, int> -> multiset
template<class T> using min_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T, typename U>
pair<T, U> operator + (pair<T, U>& a, pair<T, U>& b){ return make_pair(a.first + b.first, a.second + b.second); }
template<typename T, typename U>
pair<T, U> operator += (pair<T, U>& a, pair<T, U> b){ a = a+b; return a; }
template<typename T, typename U>
istream& operator >> (istream& in, pair<T, U>& a){ in >> a.first >> a.second; return in; }
template<typename T, typename U>
ostream& operator << (ostream& out, const pair<T, U>& a){ out << a.first << ' ' << a.second; return out; }
template<typename T>
bool ckmin(T& a, T b){ return a > b ? a = b, true : false; }
template<typename T>
bool ckmax(T& a, T b){ return a < b ? a = b, true : false; }
const int IINF = 2e9 + 1, MOD = 998244353, MOD2 = 1e9 + 7, root = 48;
const ll INF = 1e18;
const double PI = acos(-1), eps = 1e-9;
const int dx[] = {0, 1, 0, -1}, dy[] = {-1, 0, 1, 0}; // LDRU
const int N = 5e3 + 3;
set<int, greater<int>> lazy[N];
int vis[N][N];
int main(){
fcin;
cin.tie(0);
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
int t = 1;
// cin >> t;
while(t--){
int n, a, b;
cin >> n >> a >> b;
vector<pii> xx(n), yy(n);
for(int i = 0; i < n; ++i){
cin >> xx[i].f >> xx[i].s >> yy[i].f >> yy[i].s;
xx[i] += mp(-a, -a);
yy[i] += mp(-b, -b);
}
vis[0][0] = 1;
lazy[0].insert(0);
for(int i = 0; i < n; ++i){
lazy[i].insert(-1);
}
set<int> hmm = {1, 2, 3, 4, 5, 6, 7};
for(int i = 0; i < n; ++i){
auto [xl, xr] = xx[i];
auto [yl, yr] = yy[i];
int lim = min(xr, n-1);
for(int j = xl; j <= lim; ++j){
for(auto it = lazy[j].lower_bound(yr); *it >= yl; it = lazy[j].erase(it)){
int k = *it;
if(!vis[j+1][k]){
vis[j+1][k] = 1;
lazy[j+1].insert(k);
}
if(!vis[j][k+1]){
vis[j][k+1] = 1;
lazy[j].insert(k+1);
}
}
}
}
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 << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3752kb
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: 14748kb
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: 22ms
memory: 14024kb
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: 0
Accepted
time: 17ms
memory: 4400kb
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:
4994
result:
ok single line: '4994'
Test #5:
score: -100
Wrong Answer
time: 20ms
memory: 25812kb
input:
5000 716580777 76836128 716580777 716580777 76836128 76836128 716580777 716580777 76836129 76836129 716580777 716580777 76836130 76836130 716580777 716580777 76836131 76836131 716580778 716580778 76836131 76836131 716580779 716580779 76836131 76836131 716580780 716580780 76836131 76836131 716580778 ...
output:
4997
result:
wrong answer 1st lines differ - expected: '4994', found: '4997'