제출 #246351

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2463512020-07-08 19:22:22kostia244길고양이 (JOI20_stray)C++17
100 / 100
79 ms22912 KiB
#include "Anthony.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
namespace anton {
const int maxn = 1<<17;
vector<int> val, p, pidx, col, god = {0, 0, 1, 0, 1, 1};
vector<array<int, 2>> g[maxn];
void dfs(int v) {
for(auto &[i, idx] : g[v]) if(i != p[v]) {
p[i] = v, pidx[i] = idx;
col[i] = col[v]^1;
dfs(i);
}
//cout << v << " // " << col[v] << '\n';
if(!v || g[v].size() == 2) return;
int u = p[v];
vector<int> l {v};
while(u && g[u].size() == 2) {
l.pb(u);
u = p[u];
}
int b = 0;
while(god[b] != col[v] || god[(b + l.size() - 1)%6] != col[l.back()]) b++;
//cout << v << " /// " << b << endl;
//cout << god[b] << " vs " << col[v] << '\n';
for(int i = 0; i < l.size(); i++) val[pidx[l[i]]] = god[(i+b)%6];
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

Anthony.cpp: In function 'void anton::dfs(int)':
Anthony.cpp:29:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < l.size(); i++) val[pidx[l[i]]] = god[(i+b)%6];
                 ~~^~~~~~~~~~
#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...