# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
876599 | davinpwk | The Xana coup (BOI21_xanadu) | C++14 | 42 ms | 15720 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fi first
#define se second
#define pb push_back
#define TC int t; cin>>t; while(t--)
#define all(x) (x).begin(),(x).end()
//*AC BERSAMA ALLAH FORTIS FORTUNA ADIUVAT
const ll nx = 1e5+5;
vector<ll> adj[nx];
bool on[nx], vis[nx];
ll dp[nx][2][2];
ll n;
void dfs(ll nd){
vis[nd] = 1;
if(on[nd])
dp[nd][1][0] = 1, dp[nd][0][1] = 0;
else
dp[nd][1][1] = 1, dp[nd][0][0] = 0;
for(ll i : adj[nd]){
if(!vis[i]){
dfs(i);
ll x = dp[nd][0][0], y = dp[nd][0][1];
dp[nd][0][0] = min(x + dp[i][0][0], y + dp[i][1][0]);
dp[nd][0][1] = min(y + dp[i][0][0], x + dp[i][1][0]);
x = dp[nd][1][0], y = dp[nd][1][1];
dp[nd][1][0] = min(x + dp[i][0][1], y + dp[i][1][1]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |