QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#560742 | #3953. Jane Eyre | LaVuna47# | WA | 1ms | 3912kb | C++17 | 3.8kb | 2024-09-12 17:38:14 | 2024-09-12 17:38:14 |
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 < 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
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3660kb
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: 3788kb
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: 3656kb
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: 0
Accepted
time: 0ms
memory: 3836kb
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...
output:
10220
result:
ok single line: '10220'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
10 10 69762 "UF nLt0Vhbyer18ho J9" 82295 "GIqZu9XjtfZfMH394PgW" 38133 "HcNozTLICpbH2k9WN71D" 83977 "TUgBkFwVkkbMu0s0OHHH" 96616 "ODFjKafCfafTqJbYubR6" 50022 "Z78YVdblLhn 5W5y9LcA" 38266 "VYFoQ8HVxypn1A1UB6Oo" 49950 "FTF 5fEPbqZzZ4uq E2r" 58131 "Hs1 YEE66503r7SfGeOp" 85586 "SdYqsatvU3d7FKFx9yhS" 8831...
output:
335589
result:
ok single line: '335589'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10 10 69561 "JlbEtL0hkSh9LdedWKTd" 63412 "C hXL 8 kIjEdk9 7bhW" 76109 "FrVS7IgcAhIdjdzeXzyW" 7472 "CGKpE4i6wrSHE g0QQqN" 22128 "ECjpCrkmBvFXZP5xij6x" 14163 "CJRuQQAA01VVbeZ0XZnc" 2828 "FzaKrVrc8DZUuX2XFy2V" 7097 "GlTHrbSwVw ez9bypSOm" 69698 "Ay6f9xa ji9iqiWvkgSV" 26038 "J6jDx5GUOly5mN5B1q9X" 51045 2...
output:
346139
result:
ok single line: '346139'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
10 10 69693 " vHXDOlk HYT8Bs Jy3M" 48617 "L8yz Sm dxfkUm8eo Ub" 73382 "JKY8v WCCP6kY6 vg6qr" 80240 "InbQ GXsoMu5LvvmJsyc" 92494 "AYuzuv9zIbkakEK 999y" 56453 "OK 7EASyleC8 ZqMY7Ls" 43986 "KlEK54EWhlEG0thJUOpR" 60825 "HS5eSEMNFzxIDQKU7v C" 83552 " kq6uMZbMFZk Y Dk5tc" 46843 "OPL ZO8dZmz2R0BYVCgd" 4910...
output:
477892
result:
ok single line: '477892'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
100 100 92947 "NzpHYI0uUOhGNATMkDJ0" 80488 "Dq5pFmExIH6YIhk8gF7e" 36128 "L2XVNd6DCMY7Cx4uNiMW" 5921 " 9kQ 1L85npvtdCQEsy " 24 "S3XviT0pVLcZ 1KuOP7r" 30694 "V74ZUfYng4myyADt3d1o" 81609 "PrpvIBnTyqNKy1TBsABP" 11553 "RDIOYQ aV2Ii6Uf9wS6 " 62929 "AID3Nyxn6t Q XBcT4fe" 60396 "FZJSg6cRBzH 8M1 baxx" 61125 ...
output:
1524646
result:
ok single line: '1524646'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
100 100 71834 "kxgcqR8sIJ2gYpHvb4df" 36164 "jNeNzV4zkilslESeHE3k" 63386 "fIOitUU6nTtIM2KbWhZN" 6669 "NwZm2XcSKhtJq9M4OuXb" 4011 "NRjvPt9MEJaXqfHrgF A" 75469 "B7T3TdIJD azmUve1tyk" 88326 "idP FMul6gNNY svMQDj" 16531 "C2q1SRMW7wvW5mdqrDUA" 90796 "czodS896mDIR7FcPaPnb" 28773 " m JohmfrdayvA5J7JG" 1807...
output:
1740900
result:
ok single line: '1740900'
Test #10:
score: -100
Wrong Answer
time: 1ms
memory: 3912kb
input:
1000 1000 29126 "stZms2nZ 4Ck3Ikknqmj" 52506 "DwS J2Yyel7W4tu9ep a" 60535 "8o7R1lyGYg4tImfouN2r" 5850 "x4iXNIHFdo8Ep3WrlKY8" 63856 "uh8EwbdQS52SCfXxTW6J" 3636 "nCsW7q 9i8vzPSzjElnn" 60400 "kcUH sEF9B1eXzhKxNTU" 88900 "o2ni3bJKRGeYZsEk8EHq" 63718 "XDqeo7OH2CVy8OwbuXRM" 91697 "O0fq dFumsDwepSiEOTb" 23...
output:
17607909
result:
wrong answer 1st lines differ - expected: '17988558', found: '17607909'