제출 #211242

#제출 시각아이디문제언어결과실행 시간메모리
211242LawlietMagic Tree (CEOI19_magictree)C++14
0 / 100
64 ms2160 KiB
#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",&k,&val[node]); } 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); }

컴파일 시 표준 에러 (stderr) 메시지

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",&k,&val[node]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...