# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
827181 | LeSonnn | Jousting tournament (IOI12_tournament) | C++17 | 0 ms | 0 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>
#define task "tournament"
using namespace std;
typedef long long ll;
typedef pair <int, int> ii;
#define fi first
#define se second
const int N = 1e6 + 9;
ll n, m, k;
set<ll> s;
void progress()
{
cin >> n >> n >> m;
for (int i = 1; i <= n; i++)
{
s.insert(i);
}
vector <ll> ans(n + 1), res;
for ( ; m--;)
{
ll l, r, w;
cin >> l >> r >> w;
auto it = s.lower_bound(l);
res.clear();
while (it != s.end() && *it <= r)
{
if (*it != w)
{
ans[*it] = w;
res.emplace_back(*it);
}
it++;
}
for (auto i : res)
{
s.erase(i);
}
}
for (int i = 1; i <= n; i++)
{
cout << ans[i] << " ";
}
}
signed main()
{
// Author : Shyn_
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
if(fopen(task ".inp", "r"))
{
freopen(task ".inp", "r", stdin);
freopen(task ".out", "w", stdout);
}
ll nt(1);
// cin >> nt;
for ( ; nt--;)
{
progress();
}
return 0;
}
/* LCG */