# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
865516 |
2023-10-24T09:18:24 Z |
vjudge1 |
Meteors (POI11_met) |
C++17 |
|
6000 ms |
4700 KB |
//Bismillahir-Rahmanir-Rahim
#include <bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0),cin.tie(0)
#define pb push_back
#define ll long long
#define ld long double
#define dbg(x) cerr << #x << " = " << x << "\n";
#define ff first
#define ss second
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma comment (linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const long long INF = 1e9 + 7;
const long long MOD = 1e9 + 7;
const int maxn = 3e5 + 10;
int n, m, k, p[maxn], o[maxn], ans[maxn], met[maxn], cnt;
void press_F_() {
cin >> n >> m;
for (int i = 1; i <= m; i++) {
cin >> o[i];
}
for (int i = 1; i <= n; i++) {
cin >> p[i];
}
cin >> k;
int id = 1;
cnt = n;
while(k--) {
int l, r, a;
cin >> l >> r >> a;
if (l <= r) {
for (int i = l; i <= r; i++) {
met[o[i]] += a;
}
} else {
for (int i = l; i <= m; i++) {
met[o[i]] += a;
}
for (int i = 1; i <= r; i++) {
met[o[i]] += a;
}
}
if (cnt == 0) {
continue;
}
for (int i = 1; i <= n; i++) {
if (met[i] >= p[i] && ans[i] == 0) {
ans[i] = id;
cnt--;
}
}
id++;
}
for (int i = 1; i <= n; i++) {
if (ans[i] == 0) {
cout << "NIE" << '\n';
} else {
cout << ans[i] << '\n';
}
}
}
int main() {
flash;
// srand(time(0));
int T = 1;
// cin >> T;
for (int i = 1; i <= T; i++) {
// cout << "Case" << " " << i << ':' << "\n";
press_F_();
}
//Respa gold 2023-2024 InshAllah
return 0;
}
/*
Maybe not today and tomorrow, but InshAllah one day I will reach expert
*/
// g++ -std=c++17 main.cpp
// ./a.out
Compilation message
met.cpp:15: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
15 | #pragma GCC optimization ("O3")
|
met.cpp:16: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
16 | #pragma comment (linker, "/stack:200000000")
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1342 ms |
2392 KB |
Output is correct |
2 |
Correct |
1697 ms |
2676 KB |
Output is correct |
3 |
Correct |
610 ms |
2640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
555 ms |
2572 KB |
Output is correct |
2 |
Correct |
520 ms |
2392 KB |
Output is correct |
3 |
Correct |
1788 ms |
2696 KB |
Output is correct |
4 |
Correct |
26 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
886 ms |
2532 KB |
Output is correct |
2 |
Correct |
988 ms |
2692 KB |
Output is correct |
3 |
Correct |
17 ms |
2396 KB |
Output is correct |
4 |
Correct |
623 ms |
2624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2024 ms |
2500 KB |
Output is correct |
2 |
Correct |
2149 ms |
2580 KB |
Output is correct |
3 |
Correct |
765 ms |
2644 KB |
Output is correct |
4 |
Correct |
1063 ms |
2688 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6046 ms |
4700 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
6073 ms |
4560 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |