Submission #728430

# Submission time Handle Problem Language Result Execution time Memory
728430 2023-04-22T11:31:25 Z NeroZein Wombats (IOI13_wombats) C++17
0 / 100
12 ms 16340 KB
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std; 

const int M = 202;
const int N = 5005;

int seg[N << 2]; 

void upd (int nd, int l, int r, int p, int val) {
  if (l == r) return void (seg[nd] = val); 
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1);
  if (p <= mid) {
    upd(nd + 1, l, mid, p, val); 
  } else {
    upd(rs, mid + 1, r, p, val); 
  } 
  seg[nd] = seg[nd + 1] + seg[rs]; 
}

int qry (int nd, int l, int r, int s, int e) {
  if (l >= s && r <= e) return seg[nd];
  int mid = (l + r) >> 1;
  int rs = nd + ((mid - l + 1) << 1); 
  if (mid >= e) return qry(nd + 1, l, mid, s, e);
  if (mid < s) return qry(rs, mid + 1, r, s, e);
  return qry(nd + 1, l, mid, s, e) + qry(rs, mid + 1, r, s, e); 
}

int r, c;
int h[N][M], v[N][M];

void init(int R_, int C_, int H[5000][200], int V[5000][200]) {
  r = R_, c = C_;
  assert(c == 1); 
  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c - 1; ++j) {
      h[i][j] = H[i][j];
    }
  }//usless
  for (int i = 0; i < r - 1; ++i) {
    for (int j = 0; j < c; ++j) {
      v[i][j] = V[i][j];
      upd(0, 0, r - 1, j, v[i][j]); 
    }
  }
}

void changeH(int P, int Q, int W) {
    /* ... */
}

void changeV(int P, int Q, int W) {
  assert(Q == 0);
  upd(0, 0, r - 1, P, W); 
}

int escape(int V1, int V2) {
  assert(V1 == 0); 
  assert(V2 == 0); 
  return seg[0]; 
}

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8148 KB Output is correct
2 Incorrect 5 ms 8148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Runtime error 2 ms 468 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 728 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 16340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 724 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 724 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -