# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
496254 |
2021-12-21T04:13:18 Z |
Nalrimet |
Meteors (POI11_met) |
C++17 |
|
6000 ms |
2172 KB |
//#pragma GCC target("avx2")
//#pragma GCC optimization("O3")
//#pragma GCC optimization("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#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];
ll b[N], x;
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];
}
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){
for(int j = l; j <= r; ++j){
if(b[a[j]] <= 0) continue;
else{
b[a[j]] -= x;
if(b[a[j]] <= 0) ans[a[j]] = i;
}
}
}
else{
for(int j = l; j <= m; ++j){
if(b[a[j]] <= 0) continue;
else{
b[a[j]] -= x;
if(b[a[j]] <= 0) ans[a[j]] = i;
}
}
for(int j = 1; j <= r; ++j){
if(b[a[j]] <= 0) continue;
else{
b[a[j]] -= x;
if(b[a[j]] <= 0) ans[a[j]] = i;
}
}
}
// for(int i = 1; i <= n; ++i){
// cout << b[i] << ' ';
// }
// cout << '\n';
}
for(int i = 1; i <= n; ++i){
if(ans[i]) cout << ans[i] << '\n';
else cout << "NIE\n";
}
}
Compilation message
met.cpp:22:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
22 | main() {
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
3 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
3 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
601 ms |
548 KB |
Output is correct |
2 |
Correct |
5668 ms |
832 KB |
Output is correct |
3 |
Correct |
2938 ms |
668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1589 ms |
616 KB |
Output is correct |
2 |
Correct |
2215 ms |
588 KB |
Output is correct |
3 |
Correct |
1717 ms |
804 KB |
Output is correct |
4 |
Correct |
14 ms |
716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2269 ms |
556 KB |
Output is correct |
2 |
Correct |
4571 ms |
800 KB |
Output is correct |
3 |
Correct |
30 ms |
204 KB |
Output is correct |
4 |
Correct |
2241 ms |
700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2296 ms |
532 KB |
Output is correct |
2 |
Correct |
4336 ms |
628 KB |
Output is correct |
3 |
Correct |
1421 ms |
532 KB |
Output is correct |
4 |
Correct |
5132 ms |
932 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6075 ms |
2172 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6093 ms |
2092 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |