QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#560740 | #3953. Jane Eyre | LaVuna47# | RE | 0ms | 3632kb | C++17 | 3.8kb | 2024-09-12 17:37:02 | 2024-09-12 17:37:04 |
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)
{
string full = "";
string tmp;
cin.ignore();
getline(cin, tmp);
//cout << tmp << '\n';
if (tmp[0] == '\"')
tmp = tmp.substr(1);
int j = 0;
while (j < sz(tmp) && tmp[j] != '\"')
full += tmp[j++];
string pg="";
j++;
while (j < sz(tmp))
{
if (tmp[j] == '\n')
break;
if (tmp[j] != ' ')
pg += tmp[j];
j++;
}
//cout << pg << '\n';
int pages = stoi(pg);
if (full < "Jane Eyre")
{
s.insert(make_pair(full, pages));
//ans += pages;
}
//cout << full << '\n';
}
vector<pair<ll, pair<string, int>>> gg;
FOR (i, m)
{
ll time;
cin >> time;
string tmp = "", full="";
cin.ignore();
getline(cin, tmp);
if (tmp[0] == '\"')
tmp = tmp.substr(1);
int j = 0;
while (j < sz(tmp) && tmp[j] != '\"')
full += tmp[j++];
j++;
string pg="";
while (j < sz(tmp))
{
if (tmp[j] != ' ')
pg += tmp[j];
j++;
}
int pages = stoi(pg);
if (full < "Jane Eyre")
{
pair<ll, pair<string, int>> curr;
curr.x = time;
curr.y.x = full;
curr.y.y = pages;
gg.pb(curr);
}
}
int j = 0;
while (1)
{
while (j < m && 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
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
input:
2 2 592 "Pride and Predjudice" 432 "Don Quixote" 863 863 "Great Gatsby" 218 1082 "Crime and Punishment" 545
output:
1673
result:
ok single line: '1673'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
10 10 50116 "0sHzkZ q jriAgwD3WXL" 72225 "r6QBE1wVEmZiM0tY Nnb" 66075 "I6P vym0M DntAv83NeD" 2926 "EJKCvB958OXibIVU6V8b" 59599 "Bm1sD2u 3i32wbCrMXbP" 97406 "l DyFdoVV 3BZ3pijw8A" 50291 "v s2v2DofsHcQ1GdJJdc" 97497 " s Yca oEz5prWklLuN" 21457 "CfpaCUZfRhs18Mmi 4IF" 11100 " yODdnhrY7N60tC2CoSE" 94220...
output:
409049
result:
ok single line: '409049'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
10 10 98610 "ALKkVd61EUtolu 8EDkx" 41742 "AHkkW5DKOIDFCl6QUXAn" 77262 "Ad0 kJhBYNHG83NR850H" 55433 "AL4NMCX3N1Dxwdm10tsC" 76163 "Aw3E53uJ6K3k6s9ATEnq" 21003 "ANDvQo fSh77rCRH6EQU" 22376 "AsVW43DWfWRkXvrkjkvU" 98829 "ArXMzkCPkbldCqMNdZCv" 7864 "Ax5 9 jwxiw 2fV8zdc" 92564 "A5TEAiOah DdvF7pTy2L" 86617...
output:
678463
result:
ok single line: '678463'
Test #4:
score: -100
Runtime Error
input:
10 10 10220 "ahBreCmRHgxjj9 CHCl6" 82310 "aah3IaP5FEZtGBzPV c4" 86888 "aiQrb8xirbrqEqTZAzt2" 4237 "aQlyIBy73YyyoT3TnBIU" 99383 "aiq3hD9UfN18aPIzzLiI" 53801 "a7TFhekRmmwnN 8t4ct7" 68306 "acD8ynsouRkMER 17tcr" 66486 "aceWkXel7cmNDQd 284f" 24563 "aMNfg2uVKh1v82PEYeX9" 44579 "aCbsrPFFmg9 4EdAJNEZ" 53470...