# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
860149 |
2023-10-11T19:36:35 Z |
aykhn |
Trading (IZhO13_trading) |
C++14 |
|
367 ms |
65536 KB |
#include <bits/stdc++.h>
// author : aykhn
using namespace std;
typedef long long ll;
#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define int ll
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<multiset<int>> v1(n + 1);
vector<multiset<int>> v2(n + 2);
while (m--)
{
int l, r, x;
cin >> l >> r >> x;
v1[l].ins(x - l);
v2[r + 1].ins(x - l);
}
multiset<int> ms;
for (int i = 1; i <= n; i++)
{
for (int x : v2[i]) ms.erase(ms.lower_bound(x));
for (int x : v1[i]) ms.ins(x);
if (!ms.empty())
{
cout << *ms.rbegin() + i << " ";
}
else
{
cout << 0 << " ";
}
}
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
860 KB |
Output is correct |
7 |
Correct |
163 ms |
34816 KB |
Output is correct |
8 |
Correct |
179 ms |
37968 KB |
Output is correct |
9 |
Correct |
202 ms |
40392 KB |
Output is correct |
10 |
Correct |
244 ms |
45548 KB |
Output is correct |
11 |
Correct |
199 ms |
44600 KB |
Output is correct |
12 |
Correct |
264 ms |
51412 KB |
Output is correct |
13 |
Correct |
244 ms |
50516 KB |
Output is correct |
14 |
Correct |
273 ms |
53616 KB |
Output is correct |
15 |
Correct |
336 ms |
57576 KB |
Output is correct |
16 |
Correct |
341 ms |
58020 KB |
Output is correct |
17 |
Correct |
311 ms |
59072 KB |
Output is correct |
18 |
Correct |
339 ms |
63568 KB |
Output is correct |
19 |
Correct |
334 ms |
62408 KB |
Output is correct |
20 |
Correct |
367 ms |
65536 KB |
Output is correct |