Submission #655128

# Submission time Handle Problem Language Result Execution time Memory
655128 2022-11-03T07:51:44 Z snpmrnhlol Meteors (POI11_met) C++17
24 / 100
6000 ms 21060 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll v[300000],v2[300000],l[300000],r[300000];
ll v3[300000],v4[300000],v5[300000];
vector <ll> v6[300000];
ll v7[300000];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,m,i,q,j;
    cin>>n>>m;
    for(i = 0;i < m;i++)cin>>v[i],v[i]--;
    for(i = 0;i < n;i++){
        cin>>v2[i];
    }
    cin>>q;
    for(i = 0;i < q;i++){
        cin>>v3[i]>>v4[i]>>v5[i];
        v3[i]--;
        v4[i]--;
    }
    for(i = 0;i < n;i++)l[i] = 0,r[i] = q;
    for(i = 0;i < 30;i++){
        for(j = 0;j < q;j++)v6[j].clear();
        for(j = 0;j < n;j++)v7[j] = 0;
        for(j = 0;j < n;j++){
            if(l[j] != r[j]){
                v6[(l[j] + r[j])/2].push_back(j);
            }
        }
        ///simulate
        for(j = 0;j < q;j++){
            for(int p = v3[j];p != v4[j];p = (p + 1)%m){
                //cout<<p<<' '<<v4[j]<<'\n';
                v7[v[p]]+=v5[j];
            }
            v7[v[v4[j]]]+=v5[j];
            for(auto p:v6[j]){
                if(v7[p] >= v2[p]){
                    r[p] = j;
                }else{
                    l[p] = j + 1;
                }
            }
        }
    }
    for(i = 0;i < n;i++){
        if(l[i] == q)cout<<"NIE";
        else cout<<l[i] + 1;
        cout<<'\n';
    }
    return 0;
}
/**
3 5
1 3 2 1 3
8 1 8
3
4 2 4
1 3 1
3 5 2
**/
# Verdict Execution time Memory Grader output
1 Correct 41 ms 7480 KB Output is correct
2 Correct 63 ms 7528 KB Output is correct
3 Correct 74 ms 7504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 7508 KB Output is correct
2 Correct 67 ms 7524 KB Output is correct
3 Correct 80 ms 7560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 6034 ms 9316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6068 ms 9500 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6069 ms 9224 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6095 ms 8916 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6079 ms 21060 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6062 ms 20656 KB Time limit exceeded
2 Halted 0 ms 0 KB -