Submission #974140

#TimeUsernameProblemLanguageResultExecution timeMemory
974140anastasiskolioDeda (COCI17_deda)C++14
Compilation error
0 ms0 KiB
d#include <bits/stdc++.h> using namespace std; #define MAXN 200000 #define INFTY 1e9 + 1 int n, q, tree[4 * MAXN + 1]; void Build(int lo, int hi, int v) { if (lo == hi) { tree[v] = INFTY; return; } int mid = (lo + hi) / 2; Build(lo, mid, 2 * v); Build(mid + 1, hi, 2 * v + 1); tree[v] = min(tree[2 * v], tree[2 * v + 1]); } void Update(int lo, int hi, int v, int i, int delta) { if (lo == hi) { tree[v] = delta; return; } int mid = (lo + hi) / 2; if (i <= mid) Update(lo, mid, 2 * v, i, delta); else Update(mid + 1, hi, 2 * v + 1, i, delta); tree[v] = min(tree[2 * v], tree[2 * v + 1]); } int Min(int lo, int hi, int v, int l, int r) { if (l <= lo && hi <= r) return tree[v]; if (l > hi || r < lo) return INFTY; int mid = (lo + hi) / 2; int MinL = Min(lo, mid, 2 * v, l, r); int MinR = Min(mid + 1, hi, 2 * v + 1, l, r); return min(MinL, MinR); } void Query(int lo, int hi, int y) { if (lo == hi) { printf("%d\n", Min(1, n, 1, lo, lo) <= y ? lo : -1); return; } int j = (lo + hi) / 2; if (Min(1, n, 1, lo, j) <= y) Query(lo, j, y); else Query(j + 1, hi, y); } int main() { scanf("%d %d", &n, &q); Build(1, n, 1); while (q--) { char task; int a, b; scanf(" %c %d %d", &task, &a, &b); if (task == 'M') Update(1, n, 1, b, --a); else Query(b, n, a); } return 0; }

Compilation message (stderr)

deda.cpp:1:2: error: stray '#' in program
    1 | d#include <bits/stdc++.h>
      |  ^
deda.cpp:1:1: error: 'd' does not name a type
    1 | d#include <bits/stdc++.h>
      | ^
deda.cpp: In function 'void Build(int, int, int)':
deda.cpp:15:13: error: 'min' was not declared in this scope; did you mean 'mid'?
   15 |   tree[v] = min(tree[2 * v], tree[2 * v + 1]);
      |             ^~~
      |             mid
deda.cpp: In function 'void Update(int, int, int, int, int)':
deda.cpp:28:13: error: 'min' was not declared in this scope; did you mean 'mid'?
   28 |   tree[v] = min(tree[2 * v], tree[2 * v + 1]);
      |             ^~~
      |             mid
deda.cpp: In function 'int Min(int, int, int, int, int)':
deda.cpp:39:12: error: 'min' was not declared in this scope; did you mean 'mid'?
   39 |     return min(MinL, MinR);
      |            ^~~
      |            mid
deda.cpp: In function 'void Query(int, int, int)':
deda.cpp:44:5: error: 'printf' was not declared in this scope
   44 |     printf("%d\n", Min(1, n, 1, lo, lo) <= y ? lo : -1);
      |     ^~~~~~
deda.cpp:1:1: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
  +++ |+#include <cstdio>
    1 | d#include <bits/stdc++.h>
deda.cpp: In function 'int main()':
deda.cpp:55:3: error: 'scanf' was not declared in this scope
   55 |   scanf("%d %d", &n, &q);
      |   ^~~~~