Submission #655126

# Submission time Handle Problem Language Result Execution time Memory
655126 2022-11-03T07:42:28 Z snpmrnhlol Meteors (POI11_met) C++17
0 / 100
6000 ms 29252 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];
int v7[300000];
int main(){
    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 < m;j++)v7[j] = 0;
        for(j = 0;j < n;j++){
            if(l[j] != r[j]){
                v6[(l[j] + r[j])/2].push_back(j);
            }
            //cout<<l[j]<<' '<<r[j]<<'\n';
        }
        ///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] = (l[p] + r[p])/2;
                }else{
                    l[p] = (l[p] + r[p])/2 + 1;
                }
            }
        }
    }
    for(i = 0;i < n;i++){
        if(l[i] == n)cout<<"NIE";
        else cout<<l[i] + 1;
        cout<<'\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 7380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 7436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6050 ms 10388 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6068 ms 10704 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6057 ms 10172 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6047 ms 10060 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6053 ms 29252 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6031 ms 28824 KB Time limit exceeded
2 Halted 0 ms 0 KB -