Submission #959271

# Submission time Handle Problem Language Result Execution time Memory
959271 2024-04-07T19:13:19 Z typ_ik Sterilizing Spray (JOI15_sterilizing) C++17
5 / 100
5000 ms 3696 KB
#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

sterilizing.cpp:42:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   42 | main() {
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 5 ms 600 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 5 ms 552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3443 ms 2756 KB Output is correct
2 Correct 2147 ms 2604 KB Output is correct
3 Correct 3447 ms 2692 KB Output is correct
4 Execution timed out 5021 ms 3260 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 110 ms 844 KB Output is correct
2 Correct 259 ms 864 KB Output is correct
3 Correct 411 ms 860 KB Output is correct
4 Correct 904 ms 1828 KB Output is correct
5 Correct 3741 ms 2252 KB Output is correct
6 Correct 3701 ms 2472 KB Output is correct
7 Correct 3792 ms 2480 KB Output is correct
8 Correct 3742 ms 2516 KB Output is correct
9 Execution timed out 5098 ms 1592 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1347 ms 2128 KB Output is correct
2 Correct 1563 ms 2644 KB Output is correct
3 Correct 834 ms 1976 KB Output is correct
4 Correct 1148 ms 2612 KB Output is correct
5 Correct 3750 ms 3696 KB Output is correct
6 Correct 3766 ms 3496 KB Output is correct
7 Correct 3802 ms 3556 KB Output is correct
8 Correct 3712 ms 3560 KB Output is correct
9 Execution timed out 5102 ms 2928 KB Time limit exceeded
10 Halted 0 ms 0 KB -