Submission #19724616


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

int main(){
  ll N;
  cin >> N;
  ll A[1<<N], B[1<<N];
  rep(i, 1<<N){
    cin >> A[i];
    B[i] = A[i];
  }
  ll semi, ans;
  rep(rnd, N){
    rep(n, 1<<(N-rnd-1)){
      ll l = n << (rnd+1);
      ll r = l + (1<<rnd);
      if(rnd == N-1) semi = min(A[l], A[r]);
      if(A[l] < A[r]) A[l] = A[r]; 
    }
  }
  rep(i, 1<<N) if(B[i] == semi) ans = i + 1;
  cout << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task C - ABC Tournament
User graythunder
Language C++ (GCC 9.2.1)
Score 300
Code Size 791 Byte
Status AC
Exec Time 37 ms
Memory 4572 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:33:16: warning: ‘semi’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |   rep(i, 1<<N) if(B[i] == semi) ans = i + 1;
      |                ^~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 12
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All extreme_00.txt, handmade_00.txt, handmade_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
extreme_00.txt AC 25 ms 4564 KB
handmade_00.txt AC 2 ms 3616 KB
handmade_01.txt AC 2 ms 3516 KB
random_00.txt AC 37 ms 4452 KB
random_01.txt AC 34 ms 4572 KB
random_02.txt AC 29 ms 4532 KB
random_03.txt AC 2 ms 3436 KB
random_04.txt AC 2 ms 3560 KB
random_05.txt AC 3 ms 3552 KB
sample_01.txt AC 2 ms 3424 KB
sample_02.txt AC 2 ms 3568 KB
sample_03.txt AC 6 ms 3520 KB