Submission #865261

# Submission time Handle Problem Language Result Execution time Memory
865261 2023-10-24T06:54:44 Z vjudge1 Meteors (POI11_met) C++17
74 / 100
6000 ms 10940 KB
/// tree bends in youth
/// 24  .10.2023
/// success is doing same thing in every single day!!!
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
using namespace std;
const ll N =3e5+ 5;
const ll NN =2e6 + 5;
const ll INF = -1e1;
const ll MOD = 1e9 + 7;
const ll LG = 18;
const ll k = 316;
ll a[N],ans[N];
ll nd[N],sum[N];

void solve(){
    ll n,m,k;
    cin >> n >> m ;
    for(ll i = 1;i <= m;i++)cin >> a[i];
    for(ll i = 1;i <= n;i++){
        cin >> nd[i];
        ans[i] = 0;
    }
    cin >> k;
    for(ll z = 1;z <= k;z++){
        ll l,r;
        ll v;
        cin >> l >> r >> v;
        if(l >r){
            for(ll i = l;i <= m;i++){
                sum[a[i]] += v;
                if(sum[a[i]] >= nd[a[i]] && ans[a[i]] == 0){
                    ans[a[i]] = z;
                }
            }
            for(ll i = 1;i <= r;i++){
                sum[a[i]] += v;
                if(sum[a[i]] >= nd[a[i]] && ans[a[i]] == 0){
                    ans[a[i]] = z;
                }
            }
        }
        else{
            for(ll i = l;i <= r;i++){
                sum[a[i]] += v;
                if(sum[a[i]] >= nd[a[i]] && ans[a[i]] == 0){
                    ans[a[i]] = z;
                }
            }
        }
    }
    for(ll i = 1;i <= n;i++){
        if(ans[i] == 0)cout << "NIE\n";
        else cout << ans[i] << '\n';
    }
}
main (){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    ll abd= 1;
//    cin >> abd;
    for(ll i = 1;i <= abd;i++){
//        cout << "Case " << i << ":\n";
        solve();
    }
}

Compilation message

met.cpp:61:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   61 | main (){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 2 ms 6632 KB Output is correct
3 Correct 2 ms 6488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 2 ms 6616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1520 ms 7224 KB Output is correct
2 Correct 2932 ms 7704 KB Output is correct
3 Correct 2493 ms 7416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1128 ms 6664 KB Output is correct
2 Correct 1736 ms 6664 KB Output is correct
3 Correct 4245 ms 6808 KB Output is correct
4 Correct 8 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1662 ms 6632 KB Output is correct
2 Correct 2277 ms 6792 KB Output is correct
3 Correct 23 ms 6492 KB Output is correct
4 Correct 1523 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2969 ms 6604 KB Output is correct
2 Correct 4567 ms 6676 KB Output is correct
3 Correct 1110 ms 6612 KB Output is correct
4 Correct 3824 ms 6792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 6016 ms 10940 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6050 ms 10592 KB Time limit exceeded
2 Halted 0 ms 0 KB -