# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
694934 | 2023-02-04T13:45:28 Z | Do_you_copy | Sterilizing Spray (JOI15_sterilizing) | C++17 | 5000 ms | 7260 KB |
#include <bits/stdc++.h> #define fi first #define se second #define faster ios_base::sync_with_stdio(0); cin.tie(0); #define pb push_back using namespace std; using ll = long long; using pii = pair <int, int>; mt19937_64 Rand(chrono::steady_clock::now().time_since_epoch().count()); const int maxN = 1e5 +1; const int inf = 0x3f3f3f3f; //const int Mod = int n, q, k; ll bit[maxN]; map <int, int> mp; void update(int x, int v){ for (; x <= n; x += x & -x){ bit[x] += v; } } int get(int x){ int res = 0; for (; x; x -= x & -x){ res += bit[x]; } return res; } void Init(){ cin >> n >> q >> k; for (int i = 1; i <= n; ++i){ cin >> mp[i]; update(i, mp[i]); } mp[n + 1] = 0; while (q--){ int s, t, u; cin >> s >> t >> u; if (s == 1){ update(t, u - mp[t]); mp[t] = u; } if (s == 2){ for (auto it = mp.lower_bound(t); it->fi <= u;){ auto it1 = it++; int x = it1->se; it1->se /= k; update(it1->fi, it1->se - x); if (it1->se == 0){ mp.erase(it1); } } } if (s == 3){ cout << get(u) - get(t - 1) << "\n"; } } } #define taskname "test" signed main(){ faster if (fopen(taskname ".inp", "r")){ freopen(taskname ".inp", "r", stdin); freopen(taskname ".out", "w", stdout); } int tt = 1; //cin >> tt; while (tt--){ Init(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5021 ms | 5112 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 1108 KB | Output is correct |
2 | Correct | 26 ms | 3056 KB | Output is correct |
3 | Correct | 22 ms | 3168 KB | Output is correct |
4 | Correct | 36 ms | 2836 KB | Output is correct |
5 | Correct | 65 ms | 7260 KB | Output is correct |
6 | Correct | 69 ms | 7180 KB | Output is correct |
7 | Execution timed out | 5040 ms | 6724 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 57 ms | 4812 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |