답안 #865124

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865124 2023-10-24T05:45:08 Z vjudge1 Meteors (POI11_met) C++
24 / 100
6000 ms 27732 KB
     #include <bits/stdc++.h>
#include <sstream>
#include <fstream>
 
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
//WAS CREAtED BY BAISYN MUKHAMMED//
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
 
#define et "\n"
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ioi ios::sync_with_stdio(false); cin.tie(0);  cout.tie(0)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl

 
using namespace std;
const ll M = 1000000007;
ll n,m,k,a[511111],b[311111],c[311111],p[311111];
map <ll,ll> mp,ans;
vector <ll> v[311111];
void solve() {
	cin >> m >> n;
	for (int i = 1;i <= n;i++) {
		cin >> a[i];
	}
	for (int i = 1;i <= m;i++) {
		cin >> b[i];
		ans[i] = -1;
	}
	cin >> k;
	for (int i = 1;i <= k;i++) {
		ll l,r,x;
		cin >> l >> r >> x;
		if (l <= r) {
			for (int j = l;j <= r;j++) {
				mp[a[j]] += x;
			}
			for (int j = 1;j <= m;j++) {
				if (mp[j] >= b[j] && ans[j] == -1) {
					ans[j] = i;
				}
//				cout << mp[j] << ' ' << j << ' ' << ans[j] << et;
			}
		}
		else {
			for (int j = 1;j <= r;j++) {
				mp[a[j]] += x;
			}
			for (int j = l;j <= n;j++) {
				mp[a[j]] += x;
			}
			for (int j = 1;j <= m;j++) {
				if (mp[j] >= b[j] && ans[j] == -1) {
					ans[j] = i;
				}
//				cout << mp[j] << ' ' << j << ' ' << ans[j] << et;
			}
		}
//		cout << et;
	}
	for (int i = 1;i <= m;i++) {
//		cout << mp[i] << et;
		
		if (ans[i] == -1) {
			cout << "NIE" << et;
		}
		else {
			cout << ans[i] << et;
		}
	}
}
int main () {
	ioi;
//	freopen("promote.in","r",stdin);
//  freopen("promote.out","w",stdout);
	ll t = 1;
//	cin >> t;
	while (t--) {
//		cout << "Case " << t1 << ':' << et;
		solve();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 12892 KB Output is correct
2 Correct 26 ms 12892 KB Output is correct
3 Correct 19 ms 12888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 12888 KB Output is correct
2 Correct 29 ms 12888 KB Output is correct
3 Correct 56 ms 13020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6049 ms 13404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6038 ms 13916 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6089 ms 13400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6063 ms 12892 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6023 ms 27732 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6053 ms 25940 KB Time limit exceeded
2 Halted 0 ms 0 KB -