# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
865248 |
2023-10-24T06:49:34 Z |
vjudge1 |
Meteors (POI11_met) |
C++17 |
|
3489 ms |
45500 KB |
//gm --- akezhon
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define int long long
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define tm (tl+tr)/2
#define TL v+v, tl, tm
#define TR v+v+1, tm+1, tr
#define DA l <= tl && tr <= r
#define NET r < tl || tr < l
#define double long double
using namespace std;
const int N=3e5+7;
const int M=1e9+7;
const int inf=1e9;
int n, m, k;
int a[N];
int b[N];
struct qu{
int l, r, p;
}f[N];
struct lol{
int l, r, m, ans;
}c[N];
vector <int> q[N];
int cnt[N];
int sl[N];
void AlemAmenov(){
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 >> f[i].l >> f[i].r >> f[i].p;
}
for(int i=1; i <= n; i++){
c[i].l = 1;
c[i].r = k;
}
for(int gg=1; gg <= 20; gg++){
for(int i=1; i <= m; i++){
q[i].clear();
sl[i] = 0;
}
for(int i=1; i <= n; i++){
if(c[i].l <= c[i].r){
int md = (c[i].l + c[i].r)/2;
q[md].pb(i);
}
cnt[i] = 0;
}
for(int i=1; i <= k; i++){
if(f[i].l <= f[i].r){
sl[f[i].l] += f[i].p;
sl[f[i].r+1] -= f[i].p;
}
else {
sl[1] += f[i].p;
sl[f[i].r+1] -= f[i].p;
sl[f[i].l] += f[i].p;
}
if(q[i].size()){
int s=0;
for(int j=1; j <= m; j++){
s+=sl[j];
cnt[a[j]] += s;
}
}
for(int j : q[i]){
if(b[j] <= cnt[j]){
c[j].r = i-1;
c[j].ans = i;
}
else c[j].l = i+1;
}
if(q[i].size()){
for(int j=1; j <= m; j++){
cnt[a[j]] = 0;
}
}
}
}
for(int i=1; i <= n; i++){
if(c[i].ans)cout << c[i].ans << '\n';
else cout << "NIE\n";
}
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("promote.in", "r", stdin);
// freopen("promote.out", "w", stdout);
int RealName=1;
// cin >> RealName;
// int C=0;
while(RealName--){
// cout << "Case " << ++C << ":\n";
AlemAmenov();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
16732 KB |
Output is correct |
2 |
Correct |
3 ms |
16732 KB |
Output is correct |
3 |
Correct |
4 ms |
16732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
16732 KB |
Output is correct |
2 |
Correct |
3 ms |
16732 KB |
Output is correct |
3 |
Correct |
4 ms |
16988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
19804 KB |
Output is correct |
2 |
Correct |
80 ms |
24488 KB |
Output is correct |
3 |
Correct |
2473 ms |
21752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1331 ms |
21060 KB |
Output is correct |
2 |
Correct |
1416 ms |
21132 KB |
Output is correct |
3 |
Correct |
66 ms |
24728 KB |
Output is correct |
4 |
Correct |
209 ms |
21068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1020 ms |
20236 KB |
Output is correct |
2 |
Correct |
3489 ms |
25052 KB |
Output is correct |
3 |
Incorrect |
14 ms |
16984 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
187 ms |
19036 KB |
Output is correct |
2 |
Correct |
1743 ms |
21080 KB |
Output is correct |
3 |
Correct |
566 ms |
19788 KB |
Output is correct |
4 |
Correct |
2076 ms |
25952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
420 ms |
45500 KB |
Output is correct |
2 |
Incorrect |
145 ms |
32908 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1291 ms |
41936 KB |
Output is correct |
2 |
Incorrect |
138 ms |
31432 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |