답안 #865144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865144 2023-10-24T05:59:41 Z vjudge1 Meteors (POI11_met) C++17
74 / 100
6000 ms 7516 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define forik(x) ll i = 1; i <= x; i++

const int mod = 1e9 + 7;

using namespace std;

ll t, n, m, a[300001], b, c, d[1400001], e, p[300001], l, r, x, ans[300001], mp[300001];
vector <ll> g;

ll gcd (ll a, ll b){
	while (a > 0 && b > 0){
		if (a >= b){
			a %= b;
		}
		else{
			b %= a;
		}
	}
	return a + b;
}

ll binpow (ll a, ll b){
	a %= mod;
	if (b == 0){
		return 1;
	}
	if (b % 2 == 1){
		return binpow (a, b - 1) % mod * a;
	}
	else{
		ll t = binpow (a, b / 2) % mod;
		return t * t % mod;
	}
}

signed main (){
	//freopen (".in", "r", stdin);
	//freopen (".out", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= m; i++){
		cin >> p[i];
	}
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	cin >> t;
	for (int y = 1; y <= t; y++){
		cin >> l >> r >> x;
		if (l <= r){
			for (int i = l; i <= r; i++){
				mp[p[i]] += x;
				if (mp[p[i]] >= a[p[i]] && ans[p[i]] == 0){
					ans[p[i]] = y;
				}
			}
		}
		else{
			for (int i = l; i <= m; i++){
				mp[p[i]] += x;
				if (mp[p[i]] >= a[p[i]] && ans[p[i]] == 0){
					ans[p[i]] = y;
				}
			}
			for (int i = 1; i <= r; i++){
				mp[p[i]] += x;
				if (mp[p[i]] >= a[p[i]] && ans[p[i]] == 0){
					ans[p[i]] = y;
				}
			}
		}
	}
	for (int i = 1; i <= n; i++){
		if (ans[i] == 0){
			cout << "NIE\n";
		}
		else{
			cout << ans[i] << '\n';
		}
	}
}



# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 2 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 2 ms 4584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1514 ms 4556 KB Output is correct
2 Correct 2465 ms 5056 KB Output is correct
3 Correct 2277 ms 4756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1072 ms 4700 KB Output is correct
2 Correct 1570 ms 4700 KB Output is correct
3 Correct 3947 ms 4952 KB Output is correct
4 Correct 7 ms 4696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1327 ms 4952 KB Output is correct
2 Correct 2447 ms 5204 KB Output is correct
3 Correct 22 ms 4440 KB Output is correct
4 Correct 1332 ms 4816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2813 ms 4556 KB Output is correct
2 Correct 4112 ms 4704 KB Output is correct
3 Correct 985 ms 4584 KB Output is correct
4 Correct 3591 ms 4952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6043 ms 7516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6050 ms 7252 KB Time limit exceeded
2 Halted 0 ms 0 KB -