QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#736759#7025. How Much Memory Your Code Is Using?SGColin#WA 33ms3804kbC++171.2kb2024-11-12 13:15:052024-11-12 13:15:07

Judging History

你现在查看的是最新测评结果

  • [2024-11-12 13:15:07]
  • 评测
  • 测评结果:WA
  • 用时:33ms
  • 内存:3804kb
  • [2024-11-12 13:15:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#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 work() {
    int n;
    cin >> n;
    ll ans = 0;
    string s, tmp;
    getline(cin, s);
    rep(i, 1, n) {
        getline(cin, 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;
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t; cin >> t;
    while (t--) work();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3804kb

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: 33ms
memory: 3776kb

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'