/*#pragma GCC optimize("O3")
#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")*/
#include <bits/stdc++.h>
#define file(data) freopen(data".in", "r", stdin); freopen(data".out", "w", stdout);
#define pb push_back
#define all(data) data.begin(), data.end()
#define endl '\n'
#define ll long long
#define int long long
#define pii pair < int, int >
using namespace std;
const int N = 3e5 + 5;
const int INF = 1e9;
int n, m, o[N], p[N], ans[N], num;
void change(int l, int r, int x) {
for(int i = l; i <= r; i++) {
if(p[o[i]] > 0) {
p[o[i]] -= x;
if(p[o[i]] < 0) {
ans[o[i]] = num;
}
}
}
}
main() {
//file("pieaters");
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for(int i = 1; i <= m; i++) {
cin >> o[i];
}
for(int i = 1; i <= n; i++) {
cin >> p[i];
}
int q;
cin >> q;
while(q--) {
int l, r, x;
num++;
cin >> l >> r >> x;
if(l <= r) {
change(l, r, x);
} else {
change(l, m, x);
change(1, r, x);
}
}
for(int i = 1; i <= n; i++) {
if(ans[i] == 0) cout << "NIE\n";
else cout << ans[i] << endl;
}
}
Compilation message
met.cpp:33:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
33 | main() {
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Incorrect |
3 ms |
336 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
467 ms |
1624 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1568 ms |
2068 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1972 ms |
1516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2527 ms |
1728 KB |
Output is correct |
2 |
Correct |
4216 ms |
1988 KB |
Output is correct |
3 |
Incorrect |
1430 ms |
1752 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
6024 ms |
6472 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
6067 ms |
6128 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |