| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367167 | gvancak | Magic Tree (CEOI19_magictree) | C++20 | 15 ms | 3648 KiB |
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
const ll N=2e5+5,INF=1e12;
ll x,n,t,z,m,k,y,a[N],b[N],d[N],ans;
vector <ll> c;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
cin >> n >> m >> k;
for (int i=1; i<n; i++){
cin >> x;
//v[i+1].pb(x);
// v[x].pb(i+1);
}
for (int i=1; i<=m; i++){
cin >> a[i] >> d[i] >> x;
b[a[i]]=d[i];
}
for (int i=n; i>=1; i--){
if (b[i]==0) continue;
c.pb(b[i]);
}
int nn=c.size();
for (int i=1; i<=nn; i++) a[i]=INF;
for (int i=0; i<nn; i++){
x=lower_bound(a+1,a+nn+1,c[i])-a;
if (a[x-1]<c[i] && c[i]<a[x]) a[x]=c[i];
}
for (int i=1; i<=nn; i++){
if (a[i]!=INF) ans++;
}
cout<<ans<<endl;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
