Submission #964232

#TimeUsernameProblemLanguageResultExecution timeMemory
964232LucaIlieStray Cat (JOI20_stray)C++17
15 / 100
55 ms16968 KiB
#include "Anthony.h" #include <bits/stdc++.h> using namespace std; const int MAX_N = 2e4; const int MAX_M = 2e4; bool vis[MAX_N], visE[MAX_M]; int d[MAX_N]; vector<int> adj[MAX_N]; vector<int> Mark( int N, int M, int A, int B, vector<int> U, vector<int> V ) { vector<int> X( M ); for ( int i = 0; i < M; i++ ) { adj[U[i]].push_back( i ); adj[V[i]].push_back( i ); } queue<int> q; d[0] = 0; vis[0] = true; q.push( 0 ); while ( !q.empty() ) { int u = q.front(); q.pop(); for ( int e: adj[u] ) { if ( visE[e] ) continue; visE[e] = true; int v = (U[e] == u ? V[e] : U[e]); X[e] = d[u]; if ( vis[v] ) continue; d[v] = (d[u] + 1) % 3; vis[v] = true; q.push( v ); } } return X; }
#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...