QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#736788 | #7025. How Much Memory Your Code Is Using? | SGColin# | WA | 37ms | 4108kb | C++17 | 1.6kb | 2024-11-12 13:24:08 | 2024-11-12 13:24:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int rd() {
int x = 0;
bool f = 0;
char c = getchar();
for (; !isdigit(c); c = getchar()) f |= (c == '-');
for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
return f ? -x : x;
}
#define eb emplace_back
#define all(s) (s).begin(), (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
map<string, int> sz;
int testcase;
inline void input(string &s) {
s = "";
char c = getchar();
bool start = false;
while (c != ';') {
if (start) s += c;
else if (isalpha(c) || c == '_') {start = true; s += c;}
c = getchar();
}
}
inline void work() {
int n = rd();
ll ans = 0;
string s, tmp;
rep(i, 1, n) {
input(s);
stringstream sin(s);
vector<string> elements;
while(sin >> tmp) elements.eb(tmp);
elements.pop_back();
string type;
for (auto x : elements) type += x;
int amount = 0;
for (auto c : tmp) {
if (!isdigit(c)) continue;
amount = amount * 10 + (c - '0');
}
if (!amount) amount = 1;
ans += 1ll * sz[type] * amount;
}
printf("Case #%d: %lld\n", ++testcase, (ans + 1023) / 1024);
}
int main() {
sz["bool"] = sz["char"] = 1;
sz["int"] = sz["float"] = 4;
sz["long long"] = sz["double"] = 8;
sz["__int128"] = sz["long double"] = 16;
per(t, rd(), 1) work();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3740kb
input:
2 8 bool a; char b; int c; long long d; __int128 e; float f; double g; long double h; 1 int a[1000];
output:
Case #1: 1 Case #2: 4
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 37ms
memory: 4108kb
input:
100 976 bool qhtwlyq; bool pwwmfdzmn; bool mcrxalwy; bool geqhbouv; bool dxv; bool tbfcpc; bool qnv; bool zgobcqpd; bool b; bool v; bool oyaisd; bool llcktmy; bool bnyp; bool hvkyjkuuix; bool briut; bool xqoea; bool pcecgpydon; bool fwmmtbgn; bool ivnhli; bool js; bool anxutjks; bool va; bool dngtl;...
output:
Case #1: 1 Case #2: 1 Case #3: 4 Case #4: 0 Case #5: 16 Case #6: 4 Case #7: 8 Case #8: 0 Case #9: 92383 Case #10: 96778 Case #11: 382422 Case #12: 0 Case #13: 1492188 Case #14: 378907 Case #15: 707032 Case #16: 0 Case #17: 3 Case #18: 4 Case #19: 12 Case #20: 0 Case #21: 50 Case #22: 12 Case #23: 25...
result:
wrong answer 4th lines differ - expected: 'Case #4: 8', found: 'Case #4: 0'