class Mutalisk {
public:
int can[ 55 ] ;
int hp[ 55 ] ;
#undef int
int minimalAttacks( vector < int> x) {
#define int long long
int n = SZ( x) ;
set< PII> all;
REP ( i, n) {
all.insert ( { x[ i] , i + 1 } ) ;
}
int kl1 = 0 , kp1 = 200 , faj1 = - 1 ;
while ( kl1 <= kp1) {
int aktc1 = ( kl1 + kp1) / 2 ;
debug( aktc1) ;
auto cur = all;
VI vals{ 9 , 3 , 1 } ;
RE ( i, n) {
can[ i] = aktc1;
}
RE ( i, n) {
hp[ i] = x[ i - 1 ] ;
}
int fail = 0 ;
for ( auto v : vals) {
int rem = aktc1;
if ( v > 1 ) {
int nxt = v / 3 ;
RE ( i, n) {
if ( can[ i] * v < hp[ i] ) {
fail = 1 ;
break ;
}
int kl2 = 0 , kp2 = can[ i] , faj2 = 0 ;
while ( kl2 <= kp2) {
int aktc2 = ( kl2 + kp2) / 2 ;
if ( hp[ i] <= ( can[ i] - aktc2) * nxt + aktc2 * v) {
faj2 = aktc2;
kp2 = aktc2 - 1 ;
} else {
kl2 = aktc2 + 1 ;
}
}
rem -= faj2;
cur.erase ( MP( hp[ i] , i) ) ;
can[ i] -= faj2;
hp[ i] -= v * faj2;
if ( hp[ i] > 0 ) {
cur.insert ( MP( hp[ i] , i) ) ;
}
}
}
if ( rem < 0 ) {
fail = 1 ;
break ;
}
while ( rem && SZ( cur) ) {
rem--;
auto it = cur.end ( ) ;
it--;
int wh = it-> nd;
cur.erase ( it) ;
can[ wh] --;
if ( can[ wh] < 0 ) {
fail = 1 ;
break ;
}
hp[ wh] -= v;
if ( hp[ wh] > 0 ) {
cur.insert ( { hp[ wh] , wh} ) ;
}
}
}
RE ( i, n) {
if ( hp[ i] > 0 ) {
fail = 1 ;
}
cerr<< hp[ i] << " " ;
}
if ( ! fail) {
faj1 = aktc1;
kp1 = aktc1 - 1 ;
} else {
kl1 = aktc1 + 1 ;
}
}
return faj1;
}
} ;
Y2xhc3MgTXV0YWxpc2sgewogIHB1YmxpYzoKICAgIGludCBjYW5bNTVdOwogICAgaW50IGhwWzU1XTsKI3VuZGVmIGludAogIGludCBtaW5pbWFsQXR0YWNrcyh2ZWN0b3IgPGludD4geCkgewojZGVmaW5lIGludCBsb25nIGxvbmcKICAgIGludCBuID0gU1ooeCk7CiAgICBzZXQ8UElJPiBhbGw7CiAgICBSRVAgKGksIG4pIHsKICAgICAgYWxsLmluc2VydCh7eFtpXSwgaSArIDF9KTsKICAgIH0KICAgIAogICAgaW50IGtsMSA9IDAsIGtwMSA9IDIwMCwgZmFqMSA9IC0xOwogICAgCiAgICB3aGlsZSAoa2wxIDw9IGtwMSkgewogICAgICAKICAgICAgaW50IGFrdGMxID0gKGtsMSArIGtwMSkgLyAyOwogICAgICBkZWJ1Zyhha3RjMSk7CiAgICAgIGF1dG8gY3VyID0gYWxsOwogICAgICBWSSB2YWxzezksIDMsIDF9OwogICAgICBSRSAoaSwgbikgewogICAgICAgIGNhbltpXSA9IGFrdGMxOwogICAgICB9CiAgICAgIFJFIChpLCBuKSB7CiAgICAgICAgaHBbaV0gPSB4W2kgLSAxXTsKICAgICAgfQogICAgICBpbnQgZmFpbCA9IDA7CiAgICAgIGZvciAoYXV0byB2IDogdmFscykgewogICAgICAgIGludCByZW0gPSBha3RjMTsKICAgICAgICBpZiAodiA+IDEpIHsKICAgICAgICAgIGludCBueHQgPSB2IC8gMzsKICAgICAgICAgIFJFIChpLCBuKSB7CiAgICAgICAgICAgIGlmIChjYW5baV0gKiB2IDwgaHBbaV0pIHsKICAgICAgICAgICAgICBmYWlsID0gMTsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBpbnQga2wyID0gMCwga3AyID0gY2FuW2ldLCBmYWoyID0gMDsKICAgICAgICAgICAgd2hpbGUgKGtsMiA8PSBrcDIpIHsKICAgICAgICAgICAgICBpbnQgYWt0YzIgPSAoa2wyICsga3AyKSAvIDI7CiAgICAgICAgICAgICAgaWYgKGhwW2ldIDw9IChjYW5baV0gLSBha3RjMikgKiBueHQgKyBha3RjMiAqIHYpIHsKICAgICAgICAgICAgICAgIGZhajIgPSBha3RjMjsKICAgICAgICAgICAgICAgIGtwMiA9IGFrdGMyIC0gMTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAga2wyID0gYWt0YzIgKyAxOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZW0gLT0gZmFqMjsKICAgICAgICAgICAgY3VyLmVyYXNlKE1QKGhwW2ldLCBpKSk7CiAgICAgICAgICAgIGNhbltpXSAtPSBmYWoyOwogICAgICAgICAgICBocFtpXSAtPSB2ICogZmFqMjsKICAgICAgICAgICAgaWYgKGhwW2ldID4gMCkgewogICAgICAgICAgICAgIGN1ci5pbnNlcnQoTVAoaHBbaV0sIGkpKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocmVtIDwgMCkgewogICAgICAgICAgZmFpbCA9IDE7CiAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKHJlbSAmJiBTWihjdXIpKSB7CiAgICAgICAgICByZW0tLTsKICAgICAgICAgIGF1dG8gaXQgPSBjdXIuZW5kKCk7CiAgICAgICAgICBpdC0tOwogICAgICAgICAgaW50IHdoID0gaXQtPm5kOwogICAgICAgICAgY3VyLmVyYXNlKGl0KTsKICAgICAgICAgIGNhblt3aF0tLTsKICAgICAgICAgIGlmIChjYW5bd2hdIDwgMCkgewogICAgICAgICAgICBmYWlsID0gMTsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgICBocFt3aF0gLT0gdjsKICAgICAgICAgIGlmIChocFt3aF0gPiAwKSB7CiAgICAgICAgICAgIGN1ci5pbnNlcnQoe2hwW3doXSwgd2h9KTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgUkUgKGksIG4pIHsKICAgICAgICBpZiAoaHBbaV0gPiAwKSB7CiAgICAgICAgICBmYWlsID0gMTsKICAgICAgICB9CiAgICAgICAgY2Vycjw8aHBbaV08PCIgIjsKICAgICAgICAKICAgICAgfQogICAgICBpZiAoIWZhaWwpIHsKICAgICAgICBmYWoxID0gYWt0YzE7CiAgICAgICAga3AxID0gYWt0YzEgLSAxOwogICAgICB9IGVsc2UgewogICAgICAgIGtsMSA9IGFrdGMxICsgMTsKICAgICAgfQogICAgfQogICAgcmV0dXJuIGZhajE7CiAgICAgIAogIH0KCn07
compilation info
prog.c:1:1: error: unknown type name 'class'
class Mutalisk {
^
prog.c:1:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
class Mutalisk {
^
stdout