Submission #491295

# Submission time Handle Problem Language Result Execution time Memory
491295 2021-12-01T12:11:50 Z Wayne_Yan Meteors (POI11_met) C++17
37 / 100
6000 ms 2596 KB
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;

typedef int64_t ll;
typedef long double ld;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define F(n) Fi(i,n)
#define Fi(i,n) Fl(i,0,n)
#define Fl(i,l,n) for(int i=l;i<n;i++)
#define RF(n) RFi(i,n)
#define RFi(i,n) RFl(i,0,n)
#define RFl(i,l,n) for(int i=n-1;i>=l;i--)
#define all(v) begin(v),end(v)
#define siz(v) (ll(v.size()))
#define get_pos(v,x) (lower_bound(all(v),x)-begin(v))
#define sort_uni(v) sort(begin(v),end(v)),v.erase(unique(begin(v),end(v)),end(v))
#define mem(v,x) memset(v,x,sizeof v)
#define ff first
#define ss second
#define mid ((l+r)>>1)
#define RAN(a,b) uniform_int_distribution<int> (a, b)(rng)
#define debug(x) (cerr << (#x) << " = " << x << "\n")

template <typename T> using max_heap = __gnu_pbds::priority_queue<T,less<T> >;
template <typename T> using min_heap = __gnu_pbds::priority_queue<T,greater<T> >;
template <typename T> using rbt = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

signed main(){
  
  int m,n,k;
  cin >> n >> m;
  int o[m];
  F(m) cin >> o[i], o[i]--;
  int t[n];
  F(n) cin >> t[i];
  cin >> k;
  int ans[n];
  fill(ans, ans+n, -1);
  int curr[n] = {};

  F(k){
    int l,r,c;
    cin >> l >> r >> c;
    l--, r--;
    if(l <= r){
      Fl(j, l, r+1){
        curr[o[j]]+=c;
        if(curr[o[j]] >= t[o[j]] && ans[o[j]]==-1){
          ans[o[j]]=i;
        }
      }
    }else{
      Fl(j, 0, r+1){
        curr[o[j]]+=c;
        if(curr[o[j]] >= t[o[j]] && ans[o[j]]==-1){
          ans[o[j]]=i;
        }
      }
      Fl(j, l, m){
        curr[o[j]]+=c;
        if(curr[o[j]] >= t[o[j]] && ans[o[j]]==-1){
          ans[o[j]]=i;
        }
      }
    }
  }
   
  F(n){
    if(ans[i] == -1){
      printf("NIE");
    }else{
      printf("%d", ans[i]+1);
    }
    printf("\n");
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 3 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 204 KB Output is correct
2 Correct 3 ms 204 KB Output is correct
3 Correct 3 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1756 ms 524 KB Output is correct
2 Execution timed out 6098 ms 1892 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2080 ms 588 KB Output is correct
2 Correct 2649 ms 568 KB Output is correct
3 Execution timed out 6099 ms 716 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3543 ms 524 KB Output is correct
2 Correct 4857 ms 836 KB Output is correct
3 Correct 66 ms 204 KB Output is correct
4 Correct 2475 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 6056 ms 488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6047 ms 2596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6073 ms 2336 KB Time limit exceeded
2 Halted 0 ms 0 KB -