Submission #967443

#TimeUsernameProblemLanguageResultExecution timeMemory
967443LucaIlieStray Cat (JOI20_stray)C++17
15 / 100
36 ms16892 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], uu, vv; int pattern[6] = { 0, 0, 1, 0, 1, 1 }; vector<int> X; void dfs( int u, int p, int t ) { if ( p != -1 && adj[u].size() == 2 ) t = (t + 1) % 6; else t = (pattern[t] == 0 ? 2 : 0); for ( int e: adj[u] ) { if ( e == p ) continue; X[e] = pattern[t]; int v = (uu[e] == u ? vv[e] : uu[e]); dfs( v, e, t ); } } vector<int> Mark( int N, int M, int A, int B, vector<int> U, vector<int> V ) { X.resize( M ); uu = U; vv = V; for ( int i = 0; i < M; i++ ) { adj[U[i]].push_back( i ); adj[V[i]].push_back( i ); } if ( A >= 3 ) { 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 ); } } } else { dfs( 0, -1, 0 ); } return X; }
#include "Catherine.h" #include <bits/stdc++.h> using namespace std; set<string> down; int A, B; void Init( int a, int b ) { A = a; B = b; down.insert( "00101" ); down.insert( "01011" ); down.insert( "10110" ); down.insert( "01100" ); down.insert( "11001" ); down.insert( "10010" ); } //001011 001011 int t = -1, p = -1; bool dir = false; string s = ""; int Move( vector<int> y ) { if ( A >= 3 ) { if ( y[0] > 0 && y[2] == 0 ) return 0; if ( y[1] > 0 && y[0] == 0 ) return 1; if ( y[2] > 0 && y[1] == 0 ) return 2; } else { t++; if ( y[0] + y[1] == 0 ) { dir = true; return -1; } if ( y[0] + y[1] + (t > 0) != 2 ) { if ( t > 0 ) y[p]++; dir = true; p = (y[0] == 1 ? 0 : 1); if ( t > 0 ) y[p]--; if ( y[p] == 0) return -1; return p; } if ( dir ) { p = (y[0] == 1 ? 0 : 1); return p; } while ( y[0] > 0 ) { s += '0'; y[0]--; } while ( y[1] > 0 ) { s += '1'; y[1]--; } if ( t == 3 ) { dir = true; if ( down.find( s ) != down.end() ) return -1; } p = s.back() - '0'; return p; } }

Compilation message (stderr)

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:72:1: warning: control reaches end of non-void function [-Wreturn-type]
   72 | }
      | ^
#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...