이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
int c = p;
p = (y[0] == 1 ? 0 : 1);
if ( t > 0 )
y[c]--;
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;
}
}
컴파일 시 표준 에러 (stderr) 메시지
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:73:1: warning: control reaches end of non-void function [-Wreturn-type]
73 | }
| ^
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |