제출 #981045

#제출 시각아이디문제언어결과실행 시간메모리
981045vjudge1참나무 (IOI23_beechtree)C++17
5 / 100
50 ms6740 KiB
#include <bits/stdc++.h> #define rep(a,b,c) for(int a=b; a<c; a++) #define repr(a,b,c) for(int a=b-1; a>c-1; a--) #define repa(a,b) for(auto a:b) #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> #define ll long long #define pb push_back using namespace std; vector<int> beechtree(int N, int M, vector<int> P, vector<int> C){ vector<int> ans(N); if(N){ int c; repr(i,N,0){ if(i==N-1) ans[i]=1; else{ if(i+2==N) c=C[i+1]; if(C[i+1]!=c) break; ans[i]=1; } } return ans; } vector<int> subt[N]; rep(i,0,N) subt[i].pb(i); repr(i,N,1) repa(e,subt[i]) subt[P[i]].pb(e); rep(i,0,N){ sort(subt[i].begin(),subt[i].end()); ans[i]=subt[i].size()==1; do{ int e, cont; vector<int> s; rep(j,1,subt[i].size()){ cont=0; e=subt[i][j]; repa(f,s) if(f==C[e]) cont++; if(e==i || P[e]!=subt[i][cont]) break; if(j==subt[i].size()-1) ans[i]=1; else s.pb(C[e]); } if(ans[i]) break; }while(next_permutation(subt[i].begin(),subt[i].end())); } return ans; }

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

beechtree.cpp: In function 'std::vector<int> beechtree(int, int, std::vector<int>, std::vector<int>)':
beechtree.cpp:2:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define rep(a,b,c) for(int a=b; a<c; a++)
......
   37 |    rep(j,1,subt[i].size()){
      |        ~~~~~~~~~~~~~~~~~~         
beechtree.cpp:37:4: note: in expansion of macro 'rep'
   37 |    rep(j,1,subt[i].size()){
      |    ^~~
beechtree.cpp:42:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     if(j==subt[i].size()-1) ans[i]=1;
      |        ~^~~~~~~~~~~~~~~~~~
beechtree.cpp:22:5: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
   22 |     if(C[i+1]!=c) break;
      |     ^~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...