# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
865194 |
2023-10-24T06:27:39 Z |
vjudge1 |
Meteors (POI11_met) |
C++17 |
|
6000 ms |
1372 KB |
/// tree bends in youth
/// 24 .10.2023
/// success is doing same thing in every single day!!!
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
using namespace std;
const ll N =1e5+ 5;
const ll NN =2e6 + 5;
const ll INF = -1e1;
const ll MOD = 1e9 + 7;
const ll LG = 18;
const ll k = 316;
int a[N];
int nd[N],sum[N],ans[N];
void solve(){
int n,m,k;
cin >> n >> m ;
for(int i = 1;i <= m;i++)cin >> a[i];
for(int i = 1;i <= n;i++){
cin >> nd[i];
ans[i] = 0;
}
cin >> k;
for(int z = 1;z <= k;z++){
int l,r,v;
cin >> l >> r >> v;
if(l >r){
for(int i = l;i <= m;i++){
sum[a[i]] += v;
if(sum[a[i]] >= nd[a[i]] && ans[a[i]] == 0){
ans[a[i]] = z;
}
}
for(int i = 1;i <= r;i++){
sum[a[i]] += v;
if(sum[a[i]] >= nd[a[i]] && ans[a[i]] == 0){
ans[a[i]] = z;
}
}
}
else{
for(int i = l;i <= r;i++){
sum[a[i]] += v;
if(sum[a[i]] >= nd[a[i]] && ans[a[i]] == 0){
ans[a[i]] = z;
}
}
}
}
for(int i = 1;i <= n;i++){
if(ans[i] == 0)cout << "NLE\n";
else cout << ans[i] << '\n';
}
}
main (){
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
ll abd= 1;
// cin >> abd;
for(ll i = 1;i <= abd;i++){
// cout << "Case " << i << ":\n";
solve();
}
}
Compilation message
met.cpp:60:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
60 | main (){
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1517 ms |
688 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1095 ms |
752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1630 ms |
956 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6041 ms |
604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
1372 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
1360 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |