# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
865736 |
2023-10-24T14:59:57 Z |
vjudge1 |
Meteors (POI11_met) |
C++17 |
|
6000 ms |
7772 KB |
#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n'
#define int long long
//typedef long double ld;
typedef long long ll;
using namespace std;
const int mx=1e6 + 100;
const bool T=0;
int p[mx] , s[mx] , ans[mx] , a[mx];
int n,m,t;
void solve(){
cin >> n >> m;
for(int i = 1;i <= m;i++)cin >> p[i];
for(int i = 1;i <= n;i++)cin >> a[i];
cin >> t;
for(int j = 1;j <= t;j++){
int l , r , x;
cin >> l >> r >> x;
if(l <= r){
for(int i = l;i <= r;i++){
s[p[i]]+=x;
if(s[p[i]] >= a[p[i]] and ans[p[i]] == 0){
ans[p[i]] = j;
}
}
}
else{
for(int i = l;i <= m;i++){
s[p[i]]+=x;
if(s[p[i]] >= a[p[i]] and ans[p[i]] == 0){
ans[p[i]] = j;
}
}
for(int i = 1;i <= r;i++){
s[p[i]]+=x;
if(s[p[i]] >= a[p[i]] and ans[p[i]] == 0){
ans[p[i]] = j;
}
}
}
}
for(int i = 1;i <= n;i++){
if(ans[i] == 0)cout<<"NIE"<<ent;
else cout<<ans[i]<<ent;
}
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tt=1;
if(T)cin>>tt;
for(int i=1;i<=tt;i++){
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
2 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
2 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1509 ms |
2640 KB |
Output is correct |
2 |
Correct |
2556 ms |
5220 KB |
Output is correct |
3 |
Correct |
2516 ms |
2816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1186 ms |
2720 KB |
Output is correct |
2 |
Correct |
1741 ms |
2720 KB |
Output is correct |
3 |
Correct |
3955 ms |
5128 KB |
Output is correct |
4 |
Correct |
8 ms |
2904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1639 ms |
2920 KB |
Output is correct |
2 |
Correct |
2473 ms |
5128 KB |
Output is correct |
3 |
Correct |
22 ms |
2396 KB |
Output is correct |
4 |
Correct |
1472 ms |
2912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2922 ms |
2524 KB |
Output is correct |
2 |
Correct |
4469 ms |
2736 KB |
Output is correct |
3 |
Correct |
1089 ms |
2528 KB |
Output is correct |
4 |
Correct |
3841 ms |
5128 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6012 ms |
7508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6008 ms |
7772 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |