QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#243666 | #7025. How Much Memory Your Code Is Using? | yiyiyi# | AC ✓ | 13ms | 3572kb | C++14 | 1.9kb | 2023-11-08 15:39:03 | 2023-11-08 15:39:04 |
Judging History
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[50];
inline int calc(int v)
{
int res=0;
scanf("%s",opt+1);
int len=strlen(opt+1);
// printf("%s\n",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;
return res;
}
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("%lld\n",ans);
printf("Case #%lld: %lld\n",P,(ans-1)/1024+1);
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3568kb
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: 13ms
memory: 3572kb
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