Submission #952510

# Submission time Handle Problem Language Result Execution time Memory
952510 2024-03-24T07:24:37 Z guymmk Sterilizing Spray (JOI15_sterilizing) C++17
5 / 100
5000 ms 3948 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#define int long long
#define ll long long
#define endl "\n"
#define vi vector<int>
#define vpii vector<pair<int,int> >
#define umap unordered_map
#define uset unordered_set
#define mk make_pair
#define pb push_back
//#define pop pop_back
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define read(x) for (auto& zu: (x)) cin >> zu;
#define F first
#define S second
#define mustawa ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define pii pair<int,int>
#define mishari main
const int inf=1e9+7;
void fa(bool ok){ cout << (ok ? "Yes": "No") << "\n";}
void usaco(string s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}
void solve() {
    int n,q,k;
    cin>>n>>q>>k;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    while(q--){
        int g,l,r;
        cin>>g>>l>>r;
        l--;
        if(g==1){
            a[l]=r;
        }else if(g==2){
            for(int i=l;i<r;i++){
                a[i]/=k;
            }
        }else{
            int ans=0;
            for(int i=l;i<r;i++){
                ans+=a[i];
            }cout<<ans<<endl;
        }
    }
}

signed mishari() {
    mustawa;
    //usaco("");
    int t = 1;
    //cin>>t;
    while (t--)solve();
}

Compilation message

sterilizing.cpp: In function 'void usaco(std::string)':
sterilizing.cpp:25:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sterilizing.cpp:26:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 500 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 4 ms 348 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 5 ms 348 KB Output is correct
12 Correct 6 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3474 ms 3152 KB Output is correct
2 Correct 2155 ms 2640 KB Output is correct
3 Correct 3496 ms 3064 KB Output is correct
4 Execution timed out 5099 ms 3660 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 111 ms 860 KB Output is correct
2 Correct 267 ms 1232 KB Output is correct
3 Correct 425 ms 1148 KB Output is correct
4 Correct 938 ms 1892 KB Output is correct
5 Correct 3821 ms 2704 KB Output is correct
6 Correct 3781 ms 2696 KB Output is correct
7 Correct 3833 ms 2872 KB Output is correct
8 Correct 3820 ms 2692 KB Output is correct
9 Execution timed out 5065 ms 1852 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1360 ms 2576 KB Output is correct
2 Correct 1596 ms 2748 KB Output is correct
3 Correct 856 ms 1876 KB Output is correct
4 Correct 1173 ms 2560 KB Output is correct
5 Correct 3852 ms 3944 KB Output is correct
6 Correct 3853 ms 3948 KB Output is correct
7 Correct 3852 ms 3940 KB Output is correct
8 Correct 3790 ms 3752 KB Output is correct
9 Execution timed out 5008 ms 2840 KB Time limit exceeded
10 Halted 0 ms 0 KB -