# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242260 | 2020-06-27T07:46:27 Z | tqbfjotld | Magic Tree (CEOI19_magictree) | C++14 | 65 ms | 3060 KB |
#include <bits/stdc++.h> using namespace std; int n,m,k; int p[100005]; int d[100005]; long long w[100005]; int main(){ scanf("%d%d%d",&n,&m,&k); for (int x = 1; x<n; x++){ scanf("%d",&p[x]); p[x]--; } for (int x = 0; x<m; x++){ int a,b; long long c; scanf("%d%d%lld",&a,&b,&c); a--; d[a] = b; w[a] = c; } vector<int> v; for (int x = 0; x<n; x++){ if (w[x]==0) continue; if (v.empty()) v.push_back(-d[x]); else if (-d[x]>=v[(int)v.size()-1]){ v.push_back(-d[x]); } else{ int pos = upper_bound(v.begin(),v.end(),-d[x])-v.begin(); v[pos] = -d[x]; } } printf("%d",v.size()); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 31 ms | 1916 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 47 ms | 2424 KB | Output is correct |
5 | Correct | 48 ms | 3060 KB | Output is correct |
6 | Correct | 53 ms | 2424 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 65 ms | 2296 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 640 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |