Submission #1134047

#TimeUsernameProblemLanguageResultExecution timeMemory
1134047alexdd새로운 문제 (POI13_kon)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int a[300005],aib[3000015]; int qry(int poz) { poz+=2; int aux=0; for(int i=poz;i>0;i-=(i&(-i))) aux+=aib[i]; return aux; } void upd(int poz, int newv) { poz+=2; for(int i=poz;i<=n+2;i+=(i&(-i))) aib[i]+=newv; } void inicjuj(int n, int k, int *D) { for(int i=0;i<=n+3;i++) aib[i]=0; for(int i=0;i<n;i++) { a[i] = max(0, k - D[i]); if(a[i]==0) upd(i,+1); } } void podlej(int le, int ri) { for(int i=le;i<=ri;i++) { a[i]--; if(a[i]==0) upd(i,+1); } } int dojrzale(int le, int ri) { return qry(ri) - qry(le-1); }

Compilation message (stderr)

kon.cpp: In function 'void upd(int, int)':
kon.cpp:15:22: error: 'n' was not declared in this scope
   15 |     for(int i=poz;i<=n+2;i+=(i&(-i)))
      |                      ^