| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 952285 | Doncho_Bonboncho | Poklon (COCI17_poklon7) | C++14 | 191 ms | 64768 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
template< class T, class T2 > inline bool chkmin( T& a, const T2& b ){ return a > b ? a = b, 1 : 0; }
template< class T, class T2 > inline bool chkmax( T& a, const T2& b ){ return a < b ? a = b, 1 : 0; }
#ifndef LOCAL
#define cerr if( false )cerr
#endif
#define out(x) #x << " = " << x << " "
typedef long long ll;
const int MAX_N = 1e6 + 42;
const ll mod = 1e9 + 7;
ll L[MAX_N];
ll R[MAX_N];
__int128 f( int curr ){
cerr << " in " << out( curr ) << out( L[curr] ) << out( R[curr] ) << endl;
__int128 lSum = -1 * L[curr];
if( L[curr] > 0 ){
lSum = f( L[curr] );
}
__int128 rSum = -1 * R[curr];
if( R[curr] > 0 ){
rSum = f( R[curr] );
}
//cerr << "out " << out( curr ) << out( lSum ) << out( rSum ) << endl;
//cerr << out( std::max( lSum, rSum ) * 2 ) << endl;
return std::max( lSum, rSum ) * 2;
}
int main (){
#ifndef LOCAL
std::ios_base::sync_with_stdio( false ); std::cin.tie( NULL ); std::cout.tie( NULL );
#endif
int n;
std::cin >> n;
for( int i=1 ; i <= n ; i++ ){
std::cin >> L[i] >> R[i];
}
__int128 nas = f( 1 );
//std::cout << f( 1 ) << endl;
std::string s;
while( nas ){
s += ( nas & 1 ? "1" : "0" );
nas >>= 1;
}
reverse( s.begin(), s.end() );
std::cout << s << endl;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
