# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1042734 |
2024-08-03T10:15:30 Z |
vjudge1 |
Meteors (POI11_met) |
C++17 |
|
6000 ms |
4948 KB |
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define str string
#define pb push_back
#define pf push_front
#define nl "\n"
#define ll long long
#define int long long
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define ff first
#define ss second
#define len(a) a.size()
#define pii pair<int,int>
const int N = 5e5 + 101;
const int md = 998244353;
const int mod = 1e9 + 7;
const int mega = 1e6 + 3;
const int inf = 1e18;
ll gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(int a, int b) {
return (a / gcd(a, b)) * b;
}
int binpow(int a, int b, int m = mod) {
a %= m;
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
void solve(){
int n , m;
cin >> n >> m;
int a[m + 1];
for(int i = 1; i <= m; ++i)cin >> a[i];
int p[n + 1];
for(int i = 1; i <= n; ++i)cin >> p[i];
int k;
cin >> k;
vector<int>mp(n + 1 , 0) , ans(n + 1 , 0);
for(int j = 1; j <= k; ++j){
int l , r;
cin >> l >> r;
int x;
cin >> x;
if(l <= r){
for(int i = l; i <= r; i++){
mp[a[i]] += x;
if(mp[a[i]] >= p[a[i]] && ans[a[i]] == 0)ans[a[i]] = j;
}
}
else{
for(int i = l; i <= m; ++i){
mp[a[i]] += x;
if(mp[a[i]] >= p[a[i]] && ans[a[i]] == 0)ans[a[i]] = j;
}
// for(int i = 1; i <= n; ++i){
// if(mp[i] >= p[i])ans[i] = j;
// }
for(int i = 1; i <= r; ++i){
mp[a[i]] += x;
if(mp[a[i]] >= p[a[i]] && ans[a[i]] == 0)ans[a[i]] = j;
}
// for(int i = 1; i <= n; ++i){
// if(mp[i] >= p[i])ans[i] = j;
// }
}
}
for(int i = 1; i <= n; ++i){
if(mp[i] < p[i])cout << "NIE";
else {
// cout << mp[i] << nl;
cout << ans[i];
}
cout << nl;
}
}
signed main() {
// SPEED;
int t = 1;
// cin >> t;
while (t--) {
solve();
}
#ifndef ONLINE_JUDGE
cerr << "\n" << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
777 ms |
920 KB |
Output is correct |
2 |
Correct |
3052 ms |
1400 KB |
Output is correct |
3 |
Correct |
2182 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1043 ms |
1008 KB |
Output is correct |
2 |
Correct |
1313 ms |
1104 KB |
Output is correct |
3 |
Correct |
4622 ms |
1372 KB |
Output is correct |
4 |
Correct |
13 ms |
1112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1739 ms |
912 KB |
Output is correct |
2 |
Correct |
2254 ms |
1392 KB |
Output is correct |
3 |
Correct |
30 ms |
348 KB |
Output is correct |
4 |
Correct |
1365 ms |
1208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3101 ms |
820 KB |
Output is correct |
2 |
Correct |
4529 ms |
1024 KB |
Output is correct |
3 |
Correct |
1082 ms |
860 KB |
Output is correct |
4 |
Correct |
3263 ms |
1396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6070 ms |
4948 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6029 ms |
4688 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |