# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1089404 | Mike_Vu | Meteors (POI11_met) | C++14 | 2 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double dou;
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define BITj(x, j) (((x)>>(j))&1)
#define MASK(x) (1LL<<(x))
template<typename T> bool maximize(T &x, const T &y) {
if (x < y) {x = y; return 1;}
return 0;
}
template<typename T> bool minimize(T &x, const T &y) {
if (x > y) {x = y; return 1;}
return 0;
}
const int maxn = 1005;
int n, m, k;
int o[maxn], ans[maxn];
ll goal[maxn];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
#define name "task"
if (fopen(name".inp", "r")) {
freopen(name".inp", "r", stdin);
freopen(name".ans", "w", stdout);
}
cin >> n >> m;
for (int i = 1; i <= m; i++) {
cin >> o[i];
}
for (int i = 1; i <= n; i++) {
cin >> goal[i];
}
memset(ans, -1, sizeof(ans));
cin >> k;
for (int t = 1; t <= k; t++) {
int l, r;
ll val;
cin >> l >> r >> val;
if (l <= r) {
for (int i = l; i <= r; i++) {
goal[o[i]] -= val;
}
}
else {
for (int i = 1; i <= r; i++) {
goal[o[i]] -= val;
}
for (int i = l; i <= m; i++) {
goal[o[i]] -= val;
}
}
//check
for (int i = 1; i <= n; i++) {
if (goal[i] <= 0 && ans[i] == -1) ans[i] = t;
}
}
for (int i = 1; i <= n; i++) {
if (ans[i] == -1) cout << "NIE";
else cout << ans[i];
cout << "\n";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |