Submission #537658

# Submission time Handle Problem Language Result Execution time Memory
537658 2022-03-15T11:01:53 Z cig32 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
67 ms 78416 KB
#include "bits/stdc++.h"
using namespace std;
const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7;
//#define int long long
 
mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x, int y) {
  int u = uniform_int_distribution<int>(x, y)(rng); return u;
}
long long bm(long long b, long long p) { 
  if(p==0) return 1;
  long long r = bm(b, p/2);
  if(p&1) return (((r*r) % MOD) * b) % MOD;
  return (r*r) % MOD;
}

int st[20][MAXN];

int query_max(int l, int r) {
  int k = 32 - __builtin_clz(r-l+1) - 1;
  return min(st[k][l], st[k][r-(1<<k)+1]);
}

void solve(int tc) {
  int n, m;
  n = 1000000;
 // cin >> n >> m;
  int a[n+1];
  for(int i=1; i<=n; i++) {
   a[i] = rnd(1, 1000000000); // cin >> a[i];
    st[0][i] = a[i];
  }
  for(int i=1; i<20; i++) {
    for(int j=1; j<=n; j++) {
      if(j+(1<<i)-1 <= n) {
        st[i][j] = max(st[i-1][j], st[i-1][j+(1<<(i-1))]);
      }
    }
  }
  
}

int32_t main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int t = 1; //cin >> t;
  for(int i=1; i<=t; i++) solve(i);
}

Compilation message

sortbooks.cpp: In function 'void solve(int)':
sortbooks.cpp:26:10: warning: unused variable 'm' [-Wunused-variable]
   26 |   int n, m;
      |          ^
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 78416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 78416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 78396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 78328 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 78416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 78416 KB Output isn't correct
2 Halted 0 ms 0 KB -