QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#194250 | #7512. Almost Prefix Concatenation | ucup-team1191# | WA | 1894ms | 34656kb | C++20 | 4.0kb | 2023-09-30 19:46:16 | 2023-09-30 19:46:16 |
Judging History
answer
/*
author: Maksim1744
created: 30.09.2023 14:37:06
*/
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sum(a) ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a) (*min_element((a).begin(), (a).end()))
#define maxe(a) (*max_element((a).begin(), (a).end()))
#define mini(a) ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a) ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
template<typename T> vector<T>& operator-- (vector<T> &v){for (auto& i : v) --i; return v;}
template<typename T> vector<T>& operator++ (vector<T> &v){for (auto& i : v) ++i; return v;}
template<typename T> istream& operator>>(istream& is, vector<T> &v){for (auto& i : v) is >> i; return is;}
template<typename T> ostream& operator<<(ostream& os, vector<T> v){for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> pair<T,U>& operator-- (pair<T, U> &p){--p.first; --p.second; return p;}
template<typename T, typename U> pair<T,U>& operator++ (pair<T, U> &p){++p.first; ++p.second; return p;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U> &p){is >> p.first >> p.second; return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U> p){os << p.first << ' ' << p.second; return os;}
template<typename T, typename U> pair<T,U> operator-(pair<T,U> a, pair<T,U> b){return mp(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){return mp(a.first+b.first, a.second+b.second);}
template<typename T, typename U> void umin(T& a, U b){if (a > b) a = b;}
template<typename T, typename U> void umax(T& a, U b){if (a < b) a = b;}
#ifdef HOME
#define SHOW_COLORS
#include "/mnt/c/Libs/tools/print.cpp"
#else
#define show(...) void(0)
#define debugf(fun) fun
#define debugv(var) var
#define mclock void(0)
#define shows void(0)
#define debug if (false)
#define OSTREAM(...) ;
#define OSTREAM0(...) ;
#endif
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(423876428);
ll rnd (ll l, ll r) { return (ll)(rng() % (r - l + 1)) + l; }
ll rnd (ll r) { return rng() % r; }
ll rnd () { return rng(); }
ld rndf() { return (ld)rng() / (ld)ULLONG_MAX; }
ld rndf(ld l, ld r) { return rndf() * (r - l) + l; }
// template<typename T>
// using pq = priority_queue<T, vector<T>, greater<T>>;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n = 1e6, q = 1e6;
// cin >> n >> q;
vector<int> a(n);
vector<int> b(n);
const int inf = 1e9;
for (int i = 0; i < n; ++i) {
a[i] = rnd(1, inf);
b[i] = rnd(1, inf);
}
// cin >> a >> b;
vector<int> ord(n);
iota(ord.begin(), ord.end(), 0);
sort(ord.begin(), ord.end(), [&](int i, int j) {
return a[i] > a[j];
});
priority_queue<pair<int, int>> qu;
for (int i = 0; i < n; ++i) {
qu.emplace(b[i], i);
}
auto calc = [&](int shift) {
while (qu.top().second < shift)
qu.pop();
int bmax = qu.top().first;
int ans = 0;
for (int i : ord) {
if (bmax + a[i] <= ans) break;
ans = max(ans, a[i] + b[i + shift]);
}
return ans;
};
for (int sh = 0; sh <= q; ++sh) {
int r = calc(sh);
cout << r << '\n';
if (sh != q) {
// int v;
// cin >> v;
// b.pb(v ^ r);
b.pb(rnd(1, inf));
qu.emplace(b.back(), b.size()-1);
}
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1894ms
memory: 34656kb
input:
ababaab aba
output:
1998700234 1998212927 1998376387 1998887278 1998470459 1998287180 1998559670 1999127838 1998097203 1999082481 1998914885 1997041708 1999530430 1998248609 1998308505 1998529428 1998906640 1999815741 1999226541 1998373047 1998633405 1999427995 1998562893 1998957667 1999523669 1998888104 1999784917 199...
result:
wrong answer 1st numbers differ - expected: '473', found: '1998700234'