답안 #496391

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
496391 2021-12-21T07:10:40 Z Mukhitali Meteors (POI11_met) C++17
61 / 100
6000 ms 3404 KB
//bit chass 1
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC ("avx,avx2,fma")

#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;
	}
}

Compilation message

met.cpp:4: warning: ignoring '#pragma GCC ' [-Wunknown-pragmas]
    4 | #pragma GCC ("avx,avx2,fma")
      |
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1723 ms 744 KB Output is correct
2 Correct 5422 ms 1024 KB Output is correct
3 Correct 3595 ms 912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2109 ms 968 KB Output is correct
2 Correct 2849 ms 844 KB Output is correct
3 Correct 5560 ms 1100 KB Output is correct
4 Correct 10 ms 972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3478 ms 760 KB Output is correct
2 Correct 5161 ms 1172 KB Output is correct
3 Correct 47 ms 332 KB Output is correct
4 Correct 2695 ms 968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5638 ms 716 KB Output is correct
2 Execution timed out 6051 ms 916 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6029 ms 3404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 6036 ms 3364 KB Time limit exceeded
2 Halted 0 ms 0 KB -