QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#560833 | #3953. Jane Eyre | LaVuna47# | RE | 0ms | 0kb | C++17 | 3.1kb | 2024-09-12 18:14:03 | 2024-09-12 18:14:03 |
Judging History
answer
/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, n) for(int i = 0; i < n; ++i)
#define RFOR(i, n) for(int i = n-1; i >= 0; --i)
#define output_vec(vec) { FOR(i_, sz(vec)) cout << vec[i_] << ' '; cout << '\n'; }
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<bool> vb;
typedef short si;
typedef unsigned long long ull;
typedef long double LD;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif
int solve()
{
int n, m, k;
if (!(cin >> n >> m >> k))
return 1;
ll ans = 0;
set<pair<string, int>> s;
s.insert(make_pair("Jane Eyre", k));
FOR (i, n)
{
cin.ignore();
string full;
getline(cin, full);
vector<string> aa;
stringstream ss(full);
string place;
while (getline(ss, place, '\"')) {
aa.push_back(place);
}
string name = aa[0];
string pgs = aa[1].substr(1);
int pages = stoi(pgs);
if (name < "Jane eyre")
s.insert(make_pair(name, pages));
}
vector<pair<ll, pair<string, int>>> gg;
FOR (i, m)
{
cin.ignore();
string full;
getline(cin, full);
vector<string> aa;
stringstream ss(full);
string place;
while (getline(ss, place, '\"')) {
aa.push_back(place);
}
FOR (j, sz(aa))
cout << aa[i] << '\n';
}
int j = 0;
sort(all(gg));
while (1)
{
while (j < sz(gg) && gg[j].x <= ans)
{
s.insert(gg[j].y);
j++;
}
auto tp = s.begin();
auto el = *tp;
if (el.x == "Jane Eyre")
{
ans += el.y;
break;
}
else
{
ans += el.y;
s.erase(s.begin());
}
//cout << sz(s) << '\n';
//cout << ans << '\n';
}
cout << ans << '\n';
return 0;
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int TET = 1;
//cin >> TET;
for (int i = 1; i <= TET; i++)
{
if (solve())
{
break;
}
#ifdef ONPC
cout << "__________________________" << endl;
#endif
}
#ifdef ONPC
cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
2 2 592 "Pride and Predjudice" 432 "Don Quixote" 863 863 "Great Gatsby" 218 1082 "Crime and Punishment" 545