QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#736765#7025. How Much Memory Your Code Is Using?waylonguo#AC ✓34ms3760kbC++142.1kb2024-11-12 13:16:382024-11-12 13:16:40

Judging History

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

  • [2024-11-12 13:16:40]
  • 评测
  • 测评结果:AC
  • 用时:34ms
  • 内存:3760kb
  • [2024-11-12 13:16:38]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
using ordered_multiset=tree<int,null_type,less_equal<int>,
rb_tree_tag,tree_order_statistics_node_update>;
typedef long long ll;

void solve(){
    int n;
    cin>>n;
    long long ans=0;
    string a,b,c;
    for(int i=1;i<=n;i++){
        cin>>a>>b;
        int s=1;
        if(a=="long"){
            cin>>c;
            ll num=0;
            bool p=0;
            for(int j=0;j<c.size();j++){
                if(c[j]=='['){
                    p=1;
                    continue;
                }
                if(c[j]==']'){
                    break;
                }
                if(p==1){
                    num=num*10+c[j]-'0';
                }
            }
            if(num!=0){
                s=num;
            }
        }
        else{
            ll num=0;
            bool p=0;
            for(int j=0;j<b.size();j++){
                if(b[j]=='['){
                    p=1;
                    continue;
                }
                if(b[j]==']'){
                    break;
                }
                if(p==1){
                    //cout<<num<<endl;
                    num=num*10+b[j]-'0';
                }
            }
            if(num!=0){
                s=num;
            }
        }
        if(a=="long"){
            if(b=="double"){
                ans=ans+16*s;
            }
            if(b=="long"){
                ans=ans+8*s;
            }
        }
        if(a=="bool" || a=="char"){
            ans=ans+s;
        }
        if(a=="float" || a=="int"){
            ans=ans+4*s;
        }
        if(a=="double"){
            ans=ans+8*s;
        }
        if(a=="__int128"){
            ans=ans+16*s;
        }
    }
    cout<<(ans+1023)/1024;
}
int main(){
    int T;
    cin>>T;
    for(int _=1;_<=T;_++){
        cout<<"Case #"<<_<<": ";
        solve();
        cout<<endl;
    }
    

    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 0
Accepted
time: 34ms
memory: 3760kb

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: 8
Case #5: 16
Case #6: 4
Case #7: 8
Case #8: 16
Case #9: 92383
Case #10: 96778
Case #11: 382422
Case #12: 750000
Case #13: 1492188
Case #14: 378907
Case #15: 707032
Case #16: 1546875
Case #17: 3
Case #18: 4
Case #19: 12
Case #20: 26
Case #21: 50
Case #22: 12...

result:

ok 100 lines