QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#243659 | #7025. How Much Memory Your Code Is Using? | yiyiyi# | RE | 0ms | 0kb | C++14 | 1.8kb | 2023-11-08 15:33:36 | 2023-11-08 15:33:36 |
answer
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<bitset>
#include<set>
#define int long long
#define lowbit(x) x&(-x)
#define mp make_pair
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define forE(i,x) for(int i=head[x];i;i=nxt[i])
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const int maxn=2e5+5;
const int mod=998244353;
inline int read()
{
int x=0,f=1;char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=x*10+(c-'0');
c=getchar();
}
return x*f;
}
int T;
int a[maxn];
char opt[20];
inline int calc(int v)
{
int res=0;
scanf("%s",opt+1);
int len=strlen(opt+1);
if(opt[len-1]==']')
{
int x=0;bool flag=0;
rep(j,1,len-2)
{
if(opt[j]=='[') flag=1;
if(flag&&(opt[j]>='0')&&(opt[j]<='9')) x=x*10+(opt[j]-'0');
}
res+=x*v;
}
else res+=v;
}
signed main()
{
T=read();
rep(P,1,T)
{
int ans=0;
int n=read();
rep(i,1,n)
{
scanf("%s",opt+1);
if(opt[1]=='b') ans+=calc(1);
else if(opt[1]=='c') ans+=calc(1);
else if(opt[1]=='i') ans+=calc(4);
else if(opt[1]=='_') ans+=calc(16);
else if(opt[1]=='f') ans+=calc(4);
else if(opt[1]=='d') ans+=calc(8);
else
{
scanf("%s",opt+1);
if(opt[1]=='l') ans+=calc(8);
else ans+=calc(16);
}
}
printf("Case #%lld: %lld\n",P,(ans-1)/1024+1);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
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];