제출 #430035

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
4300352021-06-16 11:05:11lukameladzeThe Xana coup (BOI21_xanadu)C++14
100 / 100
188 ms24512 KiB
# include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
using namespace std;
const int N=3e5+5;
long long dp1[5],dp[3][3][N],x,xx,xx1,c[N],n,a,b;
vector <long long> vv,v[N];
pair <long long, long long> pp;
pair <long long, long long> go(int col, int a, int p) {
dp1[0]=0; dp1[1]=1e9;
for (int i=0; i<v[a].size(); i++) {
if (v[a][i]==p) continue;
x=v[a][i]; xx=dp1[0]; xx1=dp1[1];
dp1[0]=min(xx+dp[col][0][x], xx1+dp[col][1][x]);
dp1[1]=min(xx1+dp[col][0][x], xx+dp[col][1][x]);
}
return {dp1[0], dp1[1]};
}
void dfs(int a, int p) {
vv.clear();
for (int i=0; i<v[a].size(); i++) {
if (v[a][i]!=p) dfs(v[a][i],a);
}
for (int i=0; i<v[a].size(); i++) {
if (v[a][i]!=p) vv.pb(v[a][i]);
}
//dp[0][0][a], dp[1][0][a]
pp=go(0,a,p);
if (c[a]==0)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

xanadu.cpp: In function 'std::pair<long long int, long long int> go(int, int, int)':
xanadu.cpp:12:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |      for (int i=0; i<v[a].size(); i++) {
      |                    ~^~~~~~~~~~~~
xanadu.cpp: In function 'void dfs(int, int)':
xanadu.cpp:22:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |      for (int i=0; i<v[a].size(); i++) {
      |                    ~^~~~~~~~~~~~
xanadu.cpp:25:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |      for (int i=0; i<v[a].size(); i++) {
      |                    ~^~~~~~~~~~~~
#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...