Submission #865126

# Submission time Handle Problem Language Result Execution time Memory
865126 2023-10-24T05:47:27 Z vjudge1 Meteors (POI11_met) C++17
0 / 100
6000 ms 8540 KB
	/*Lazy propagation 21
 *
 *
 * Imansoska228
 * Imancrush
 * Imantopchik
 * .*n*.
 * Author: Imansoska
 * Slishkom slab
**/
#include <bits/stdc++.h>
using namespace std;
	
#define ll long long
#define FF first
#define SS second
#define pb push_back
#define bp pop_back()
#define pf push_front
#define int long long
#define Imansoska ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define endl cout << "\n"
//#define input cin 
//#define print cout
	
const int N = 1e5 + 13 ;
const int maxn= 1e6+100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int ima = 1e4 + 10;

int n , m , k , l , r , x;
int z[300000] , a[300000] , cnt[300000] , ans[300000];

signed main (/*Imansoska*/) {
	Imansoska
//	freopen("lepus.in","r",stdin);
//	freopen("lepus.out","w",stdout);
	cin >> n >> m;
	for ( int i=1; i<=m; i++ ) {
		cin >> z[i];
		cnt[z[i]]++;
	}
	for ( int i=1; i<=n; i++ ) {
		cin >> a[i];
	}
	cin >> k;
	for ( int i=1; i<=k; i++ ) {
		cin >> l >> r >> x;
		if ( l>r ) {
			a[z[l]]-=cnt[z[l]]*x;
			a[z[r]]-=cnt[z[r]]*x;
			if ( a[z[l]]<=0 ) {
				ans[z[l]]=i;
			}
			if ( a[z[r]]<=0 ) {
				ans[z[r]]=i;
			}
		}
		else {
			for ( int lr=l; lr<=r; lr++ ) {
				if ( a[z[lr]]>0 ) {
					a[z[lr]]-=x;
					if ( a[z[lr]]<=0 ) {
						ans[z[lr]]=i;
					}
				}
			}
		}
	}
	for ( int i=1; i<=n; i++ ) {
		if ( ans[i]==0 ) {
			cout << "NIE";
			endl;
		}
		else {
			cout << ans[i];
			endl;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 401 ms 6736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 333 ms 6652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1277 ms 6868 KB Output is correct
2 Incorrect 13 ms 8540 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 980 ms 6740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6090 ms 7360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6073 ms 7512 KB Time limit exceeded
2 Halted 0 ms 0 KB -