제출 #995449

#제출 시각아이디문제언어결과실행 시간메모리
995449irmuun참나무 (IOI23_beechtree)C++17
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> #include "beechtree.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() #define pii pair<int,int> vector<int>beechtree(int n,int m,vector<int>p,vector<int>c){ vector<int>g[n],col[n]; for(int i=1;i<n;i++){ g[p[i]].pb(i); col[p[i]].pb(c[i]); } vector<bool>same(n,false); for(int i=0;i<n;i++){ sort(all(col[i])); for(int j=1;j<col[i].size();j++){ if(col[i][j]==col[i][j-1]){ same[j]=true; } } } vector<int>b(n,0),f(m+1,0); for(int i=0;i<n;i++){ vector<int>u; priority_queue<pii,vector<pii>,greater<pii>>q; q.push({g[i].size(),i}); bool ok=true; while(!q.empty()){ auto [sz,x]=q.top(); u.pb(x); if(same[x]){ ok=false; } q.pop(); for(int y:g[x]){ q.push({g[y].size(),y}); } } if(!ok){ continue; } for(int j=1;j<u.size();j++){ if(g[u[j]].size()>g[u[j-1]].size()){ ok=false; break; } int pos=0; for(int k=0;k<g[u[j]].size();k++){ while(pos<g[u[j-1]].size()&&g[u[j-1]][pos]!=g[u[j]][k]){ pos++; } if(pos==g[u[j-1]].size()){ ok=false; break; } pos++; } if(!ok){ break; } } if(ok){ b[i]=1; } } return b; }

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

beechtree.cpp: In function 'std::vector<int> beechtree(int, int, std::vector<int>, std::vector<int>)':
beechtree.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for(int j=1;j<col[i].size();j++){
      |                     ~^~~~~~~~~~~~~~
beechtree.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         for(int j=1;j<u.size();j++){
      |                     ~^~~~~~~~~
beechtree.cpp:55:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             for(int k=0;k<g[u[j]].size();k++){
      |                         ~^~~~~~~~~~~~~~~
beechtree.cpp:56:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |                 while(pos<g[u[j-1]].size()&&g[u[j-1]][pos]!=g[u[j]][k]){
      |                       ~~~^~~~~~~~~~~~~~~~~
beechtree.cpp:59:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |                 if(pos==g[u[j-1]].size()){
      |                    ~~~^~~~~~~~~~~~~~~~~~
#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...