제출 #426806

#제출 시각아이디문제언어결과실행 시간메모리
426806ollel말 (IOI15_horses)C++17
17 / 100
146 ms40408 KiB
#include <bits/stdc++.h> #include <iostream> using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define pb push_back #define lso(x) x&(-x) typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; struct SegTree { int n; vi tr, lazy; SegTree() {n = 0;} void INTI(int N) {n = N; tr.assign(3*n,0); lazy.assign(3*n,0);} int l(int i) {return i<<1;} int r(int i) {return (i<<1)|1;} ll combine(ll a, ll b) {return max(a, b);} // void propagate_mult(int x, int L, int R) { // if (lazy[x] == 0) return; // if (R == L) { // tr[x] /= oldmaxx[x]; // oldmaxx[x] = lazy[x]; // tr[x] *= lazy[x]; // return; // } // tr[x] /= oldmaxx[x]; // oldmaxx[x] = lazy[x]; // tr[x] *= lazy[x]; // lazy[l(x)] = lazy[r(x)] = lazy[x]; // lazy[x] = 0; // } void mult(int x, int L, int R, int i, ll ov, ll nv) { if (i > R || i < L) return; if (R == L) { tr[x] /= ov; tr[x] *= nv; return; } int mid = (L + R) / 2; mult(l(x), L, mid, i, ov, nv); mult(r(x), mid + 1, R, i, ov, nv); tr[x] = combine(tr[l(x)], tr[r(x)]); } void mult(int i, ll nv, ll ov) { mult(1, 0, n - 1, i, nv, ov); } void assign(int x, int L, int R, int i, ll v) { if (i < L ||i > R) return; if (L == R) { tr[x] = v; return; } int mid = (L + R) / 2; assign(l(x), L, mid, i, v); assign(r(x), mid + 1, R, i, v); tr[x] = combine(tr[l(x)], tr[r(x)]); } void assign(int i, ll v) { assign(1, 0, n - 1, i, v); } ll query(int x, int L, int R, int i, int j) { if (i > R || j < L) return 0; if (L >= i && R <= j) return tr[x]; int mid = (L + R) / 2; return combine( query(l(x), L, mid, i, j), query(r(x), mid + 1, R, i, j) ); } ll query(int i, int j) { return query(1, 0, n - 1, i, j); } }; vi X, Y, T; int N; SegTree st; int init(int a, int x[], int y[]) { N = a; X.resize(N); Y.resize(N); T.resize(N); rep(i,0,N) X[i] = x[i]; rep(i,0,N) Y[i] = y[i]; rep(i,0,N) T[i] = X[i]; rep(i,1,N) T[i] = T[i] * T[i - 1]; st.INTI(N); rep(i,0,N) st.assign(i, T[i] * Y[i]); return st.query(0, N - 1) % 1000000009; } int updateX(int pos, int val) { X[pos] = val; rep(i,pos,N) { if (i == 0) T[i] = X[i]; else T[i] = T[i - 1] * X[i]; } rep(i,pos,N) st.assign(i, T[i] * Y[i]); return st.query(0, N - 1) % 1000000009; } int updateY(int pos, int val) { Y[pos] = val; st.assign(pos, Y[pos]*T[pos]); return st.query(0, N - 1) % 1000000009; }

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:105:29: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
  105 |   return st.query(0, N - 1) % 1000000009;
      |          ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:115:29: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
  115 |   return st.query(0, N - 1) % 1000000009;
      |          ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:121:29: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
  121 |   return st.query(0, N - 1) % 1000000009;
      |          ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...