Submission #372358

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3723582021-02-27 20:40:29LucaDantasSterilizing Spray (JOI15_sterilizing)C++17
100 / 100
224 ms5740 KiB
#include<bits/stdc++.h>
using namespace std;
constexpr int maxn = 1e5+10;
struct SegmentTree
{
long long tree[4*maxn]; int k, a[maxn];
void build(int node, int i, int j) {
if(i == j) return (void)(tree[node] = a[i]);
int m = (i+j) >> 1;
build(2*node, i, m); build(2*node+1, m+1, j);
tree[node] = tree[2*node] + tree[2*node+1];
}
void upd(int node, int i, int j, int pos, int v) {
if(i == j) return (void)(tree[node] = v);
int m = (i+j) >> 1;
if(pos <= m) upd(2*node, i, m, pos, v);
else upd(2*node+1, m+1, j, pos, v);
tree[node] = tree[2*node] + tree[2*node+1];
}
void apply(int node, int i, int j, int l, int r) {
if(i > r || j < l || !tree[node]) return;
if(i == j) return (void)(tree[node] /= k);
int m = (i+j) >> 1;
apply(2*node, i, m, l, r);
apply(2*node+1, m+1, j, l, r);
tree[node] = tree[2*node] + tree[2*node+1];
}
long long query(int node, int i, int j, int l, int r) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sterilizing.cpp: In function 'int main()':
sterilizing.cpp:39:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   39 |  int n, q, k; scanf("%d %d %d", &n, &q, &k); seg.k = k;
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sterilizing.cpp:41:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   41 |   scanf("%d", &seg.a[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~
sterilizing.cpp:44:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   44 |   int s, a, b; scanf("%d %d %d", &s, &a, &b);
      |                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...