QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#143227#7025. How Much Memory Your Code Is Using?Sorting#AC ✓5ms3524kbC++201.5kb2023-08-20 22:27:272023-08-20 22:27:30

Judging History

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

  • [2023-08-20 22:27:30]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:3524kb
  • [2023-08-20 22:27:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair < int , int > pii ;
#define fi first
#define se second
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

int id ;

void solve ( ) {
    int q ; cin >> q ;
    string a ;
    ll ans = 0 ;
    ++ q ;
    ++ id ;
    while ( q -- ) {
        getline ( cin , a ) ;
        int sz = a.size ( ) ;
        ll coef = 0 ;
        if ( a[ 0 ] == 'b' ) { coef = 1 ; } // bool
        if ( a[ 0 ] == 'c' ) { coef = 1 ; } // char
        if ( a[ 0 ] == 'i' ) { coef = 4 ; } // int
        if ( a[ 0 ] == 'l' && a[ 5 ] == 'l' ) { coef = 8 ; } // long long
        if ( a[ 0 ] == '_' ) { coef = 16 ; } // __int128
        if ( a[ 0 ] == 'f' ) { coef = 4 ; }
        if ( a[ 0 ] == 'd' ) { coef = 8 ; }
        if ( a[ 0 ] == 'l' && a[ 5 ] == 'd' ) { coef = 16 ; }
        ll hh = 1 ;
        ll nw = 0 ;
        bool fl = false ;
        for ( int i = 0 ; i < sz ; ++ i ) {
            if ( a[ i ] == '[' ) { fl = true ; }
            if ( a[ i ] == ']' ) { break ; }
            if ( fl == true && a[ i ] != '[' ) {
                nw = ( nw * 10 + ( a[ i ] - '0' ) ) ;
            }
        }
        if ( fl == true ) { hh = nw ; }
        ans += coef * hh ;
    }
    cout << "Case #" << id << ": " << ( ans + 1023 ) / 1024 << "\n" ;
}

int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    int t = 1 ; cin >> t ;
    while ( t -- ) { solve ( ) ; }
    return 0 ;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3464kb

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: 5ms
memory: 3524kb

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