Submission #959271

#TimeUsernameProblemLanguageResultExecution timeMemory
959271typ_ikSterilizing Spray (JOI15_sterilizing)C++17
5 / 100
5102 ms3696 KiB
#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")

#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define watch(x) cout << (#x) << " : " << x << '\n'
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const int N = 100100;
int c[N];

void solve() {
    int n, q, k;
    cin >> n >> q >> k;
    for (int i = 1; i <= n; i++)
        cin >> c[i];
    while (q--) {
        int s, l, r;
        cin >> s >> l >> r;
        if (s == 1) {
            c[l] = r;
        } 
        if (s == 2) {
            for (int x = l; x <= r; x++)
                c[x] /= k;
        }
        if (s == 3) {
            ll ans = 0ll;
            for (int x = l; x <= r; x++)
                ans += c[x];
            cout << ans << '\n';
        }
    }
}

main() {
    boost;
    solve();
    return 0;
}

Compilation message (stderr)

sterilizing.cpp:42:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   42 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...