Submission #284547

# Submission time Handle Problem Language Result Execution time Memory
284547 2020-08-27T15:51:29 Z limabeans Sterilizing Spray (JOI15_sterilizing) C++17
5 / 100
5000 ms 3764 KB
#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;



int n, q, k;
int a[maxn];


void brute(int type, int t, int u) {
    if (type==1) {
	int idx = t;
	int val = u;
	a[idx] = val;
    }
    if (type==2) {
	int l = t;
	int r = u;
	for (int i=l; i<=r; i++) {
	    a[i] /= k;
	}
    }
    if (type==3) {
	ll res = 0;
	int l = t;
	int r = u;
	for (int i=l; i<=r; i++) {
	    res += a[i];
	}
	cout<<res<<"\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    cin>>n>>q>>k;
    for (int i=1; i<=n; i++) {
	cin>>a[i];
    }

    for (int i=0; i<q; i++) {
	int s,t,u;
	cin>>s>>t>>u;
	brute(s,t,u);
    }
    
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 6 ms 512 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 7 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4410 ms 2932 KB Output is correct
2 Correct 2753 ms 2720 KB Output is correct
3 Correct 4424 ms 3036 KB Output is correct
4 Execution timed out 5032 ms 3172 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 144 ms 916 KB Output is correct
2 Correct 343 ms 860 KB Output is correct
3 Correct 546 ms 952 KB Output is correct
4 Correct 1200 ms 2108 KB Output is correct
5 Correct 4965 ms 2628 KB Output is correct
6 Correct 4900 ms 2368 KB Output is correct
7 Execution timed out 5006 ms 2916 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1778 ms 2532 KB Output is correct
2 Correct 2099 ms 2836 KB Output is correct
3 Correct 1111 ms 2156 KB Output is correct
4 Correct 1558 ms 2680 KB Output is correct
5 Correct 4977 ms 3764 KB Output is correct
6 Execution timed out 5009 ms 3484 KB Time limit exceeded
7 Halted 0 ms 0 KB -