Submission #755069

#TimeUsernameProblemLanguageResultExecution timeMemory
755069ooscodeSterilizing Spray (JOI15_sterilizing)C++17
5 / 100
5055 ms3964 KiB
// IN THE NAME OF ALLAH
 
#include<bits/stdc++.h>
 
using namespace std;
 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define wall cerr << "------------------------------------" << endl
#define pb push_back
#define pob pop_back
#define F first
#define S second
#define all(x) x.begin() , x.end()
#define scan scanf
#define print printf
#define outs(x) print("%lld " , x)
#define out(x) print("%lld\n" , x)
#define in(x) scan("%lld" , &x)
#define int ll

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#pragma GCC optimize("Ofast")
 
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll , ll> pll;
typedef pair<pii,int> piii;
typedef pair<pll , ll> plll;
 
const int N = 4e5+10;
const int K = 640+10;
const ll mod = 1e9+7;
const ll INF = 1e9+10;
const int P = 31;
const int lg = 25;

const int delta = 10289;

int a[N];

signed main()
{   
    fast;
    int n , m , q;
    cin >> n >> m >> q;

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

    while(m--) {
        int t , l , r;
        cin >> t >> l >> r;

        if(t == 1)
            a[l] = r;
        else if(t == 2) 
            for(int i = l ; i <= r ; i++)
                a[i] /= q;
        else {
            int s = 0;
            for(int i = l ; i <= r ; i++)
                s += a[i];
            cout << s << "\n";
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...