# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
496332 | 2021-12-21T05:55:50 Z | Nalrimet | Meteors (POI11_met) | C++17 | 6000 ms | 16248 KB |
#include<bits/stdc++.h> using namespace std; const int N = 3 * 1e5 + 5; const long long inf = 1000000000; #define ll long long #define F first #define S second #define pb push_back int n, m, a[N], k, l, r, ans[N], j; ll b[N], x; set<int> st; vector<int> del; main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for(int i = 1; i <= m; ++i){ cin >> a[i]; st.insert(i); } for(int i = 1; i <= n; ++i){ cin >> b[i]; } cin >> k; for(int i = 1; i <= k; ++i){ cin >> l >> r >> x; if(l <= r){ auto to = st.lower_bound(l); if(to == st.end()) continue; for(to; *to <= r;){ j = *to; if(b[a[j]] <= 0) del.pb(j); else{ b[a[j]] -= x; if(b[a[j]] <= 0) {ans[a[j]] = i; del.pb(j);} } to++; if(to == st.end()) break; } } else{ auto to = st.lower_bound(l); if(to == st.end()) continue; for(to; *to <= m; ){ j = *to; if(b[a[j]] <= 0) del.pb(j); else{ b[a[j]] -= x; if(b[a[j]] <= 0) {ans[a[j]] = i; del.pb(j);} } to++; if(to == st.end()) break; } to = st.begin(); if(to == st.end()) continue; for(to; *to <= r; ){ j = *to; if(b[a[j]] <= 0) del.pb(j); else{ b[a[j]] -= x; if(b[a[j]] <= 0) {ans[a[j]] = i; del.pb(j);} } to++; if(to == st.end()) break; } } for(auto to : del){ st.erase(to); } del.clear(); } for(int i = 1; i <= n; ++i){ if(ans[i]) cout << ans[i] << '\n'; else cout << "NIE\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 2920 KB | Output is correct |
2 | Execution timed out | 6080 ms | 3092 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4130 ms | 2964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5041 ms | 2920 KB | Output is correct |
2 | Execution timed out | 6096 ms | 3120 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1203 ms | 3148 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 6033 ms | 16248 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 6081 ms | 16216 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |