# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
865456 |
2023-10-24T08:44:01 Z |
vjudge1 |
Meteors (POI11_met) |
C++17 |
|
6000 ms |
21840 KB |
#include <bits/stdc++.h>
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define optimus_prime ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fxd(x) fixed << setprecision(x)
#define all(a) (a.begin() , a.end())
#define popcount(x) __builtin_popcount(x)
#define lwb lower_bound
#define upb upper_bound
#define dl double long
#define ll long long
#define pb push_back
#define sz() size()
#define F first
#define S second
using namespace std;
const ll N = 3e5+9;
const ll inf=1e9+9;
const ll mod=1e9+7;
const ll P = 37;
map <int , int> mp;
ll n , m , q , p[N] , a[N] , ans[N] , sum[N] , timer;
void solve(){
cin >> n >> m;
for (int i = 1 ; i <= m ; i++){
cin >> p[i];
mp[i]=p[i];
}
for (int i = 1 ; i <= n ; i++)cin >> a[i];
cin >> q;
while (q--){
timer++;
ll l , r , x;
cin >> l >> r >> x;
if (l<=r){
for (int i = l ; i <= r ; i++){
sum[mp[i]]+=x;
if (sum[mp[i]]>=a[mp[i]]&&!ans[mp[i]]){
ans[mp[i]]=timer;
}
}
}
else {
for (int i = l ; i <= m ; i++){
sum[mp[i]]+=x;
if (sum[mp[i]]>=a[mp[i]]&&!ans[mp[i]]){
ans[mp[i]]=timer;
}
}
for (int i = 1 ; i <= r ; i++){
if (ans[mp[i]])continue;
sum[mp[i]]+=x;
if (sum[mp[i]]>=a[mp[i]]&&!ans[mp[i]]){
ans[mp[i]]=timer;
}
}
}
}
for (int i = 1; i<= n ; i++){
if (!ans[i])cout << "NIE\n";
else cout << ans[i] << "\n";
}
}
signed main() {
optimus_prime;
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
4444 KB |
Output is correct |
2 |
Correct |
45 ms |
4444 KB |
Output is correct |
3 |
Correct |
60 ms |
4604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
4440 KB |
Output is correct |
2 |
Correct |
50 ms |
4600 KB |
Output is correct |
3 |
Correct |
60 ms |
4444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6051 ms |
6748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6099 ms |
7008 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6089 ms |
6904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6046 ms |
6748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6028 ms |
21776 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6020 ms |
21840 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |