Submission #373006

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3730062021-03-03 01:56:40sam571128Magenta (COCI21_magenta)C++14
110 / 110
95 ms11244 KiB
#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e5+5;
vector<pair<int,int>> adj[N]; //u -> {v,0/1/2} => 0->blue, 1->red, 2-> magenta
int dis[N][2], can[N][2], cnt = 0, ok = 0, hunter;
bool blue,red;
int a,b, len;
void dfs(int u, int c, int par){
for(auto [v,cc] : adj[u]){
if(v==par) continue;
if(v==b) len = dis[u][c] + 1;
if(cc==(c^1)) continue;
dis[v][c] = dis[u][c]+1;
dfs(v,c,u);
}
}
void dfs2(int u, int par){
for(auto [v,cc] : adj[u]){
if(v==par||cc==hunter||(dis[v][hunter]!=-1&&dis[v][hunter] <= dis[v][hunter^1])) continue;
if(dis[u][hunter]==-1&&dis[v][hunter]==-1) ok = 1;
dfs2(v,u);
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Main.cpp: In function 'void dfs(long long int, long long int, long long int)':
Main.cpp:15:11: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   15 |  for(auto [v,cc] : adj[u]){
      |           ^
Main.cpp: In function 'void dfs2(long long int, long long int)':
Main.cpp:25:11: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   25 |  for(auto [v,cc] : adj[u]){
      |           ^
Main.cpp: In function 'int main()':
Main.cpp:61:8: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   61 |  if(len&1^1) hunter = 0; else hunter = 1;
      |     ~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...