Submission #211243

# Submission time Handle Problem Language Result Execution time Memory
211243 2020-03-19T17:54:22 Z Lawliet Magic Tree (CEOI19_magictree) C++14
11 / 100
63 ms 3696 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long int lli;

const int MAXK = 30;
const int MAXN = 100010;
const int INF = 1000000010;

int n, m, k;

int t[MAXN];
int w[MAXN];
int dp[MAXN];
int val[MAXN];

vector< int > v;

int main()
{
	scanf("%d %d %d",&n,&m,&k);

	for(int i = 2 ; i <= n ; i++)
		scanf("%d",&k);

	for(int i = 1 ; i <= m ; i++)
	{
		int node;
		scanf("%d",&node);
		scanf("%d %d",&val[node],&k);
	}

	for(int i = n ; i > 1 ; i--)
		if( val[i] != 0 ) v.push_back( val[i] );

	int ans = 0;

	for(int i = 1 ; i <= n ; i++)
		dp[i] = INF;

	for(int i = 0 ; i < v.size() ; i++)
	{
		int ind = upper_bound( dp + 1 , dp + n + 1 , v[i] ) - dp;

		dp[ind] = v[i];
		ans = max( ans , ind );
	}

	printf("%d\n",ans);
}

Compilation message

magictree.cpp: In function 'int main()':
magictree.cpp:41:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < v.size() ; i++)
                  ~~^~~~~~~~~~
magictree.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d",&n,&m,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
magictree.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&k);
   ~~~~~^~~~~~~~~
magictree.cpp:29:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&node);
   ~~~~~^~~~~~~~~~~~
magictree.cpp:30:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&val[node],&k);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 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 32 ms 1272 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 56 ms 2160 KB Output is correct
5 Correct 59 ms 3568 KB Output is correct
6 Correct 61 ms 3696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 1520 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 512 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 -