Submission #496312

# Submission time Handle Problem Language Result Execution time Memory
496312 2021-12-21T05:30:39 Z Mukhitali Meteors (POI11_met) C++17
61 / 100
6000 ms 3396 KB
//bit chass 1
#include <bits/stdc++.h>

#define x first
#define y second
#define el "\n"
#define ll long long
#define pb push_back
#define pll pair <ll, ll>
#define pii pair <int, int>
#define all(x) x.begin(), x.end()
#define lcm(x,y) x * y / __gcd(x, y)
#define ibase ios_base::sync_with_stdio(0), cin.tie(0)

using namespace std;

const int N = 3e5 + 5, inf = 1e9 + 7, M = 2e6, MM = 2e6 + 5, K = 300;
const ll MI = 2e18;
const double P = 3.14;

ll o[N], p[N], an[N];

void solve() {
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
		cin >> o[i];
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
	}
	int k;
	cin >> k;
	for (int i = 1; i <= k; i++) {
		int l, r, a;
		cin >> l >> r >> a;
		while (true) {
			if (l == m + 1)
				l = 1;
			if (p[o[l]] > 0 && p[o[l]] <= a) 
				an[o[l]] = i;
			p[o[l]] -= a;
			if (l == r)
				break;
			l++;
		}
	}
	for (int i = 1; i <= n; i++) {
		if (an[i])
			cout << an[i] << el;
		else 
			cout << "NIE" << el;
	}
}

int main() {
	ibase;
	int T = 1;
//	cin >> T;
	for (int i = 1; i <= T; i++) {
//		cout << "Case " << i << ": ";
		solve();
		cout << el;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1707 ms 744 KB Output is correct
2 Correct 5457 ms 1068 KB Output is correct
3 Correct 3596 ms 964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2182 ms 844 KB Output is correct
2 Correct 2776 ms 848 KB Output is correct
3 Correct 5393 ms 1100 KB Output is correct
4 Correct 11 ms 972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3523 ms 1008 KB Output is correct
2 Correct 5080 ms 1100 KB Output is correct
3 Correct 70 ms 332 KB Output is correct
4 Correct 2668 ms 968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5741 ms 716 KB Output is correct
2 Execution timed out 6080 ms 816 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6083 ms 3396 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6076 ms 3276 KB Time limit exceeded
2 Halted 0 ms 0 KB -