#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a))
#define MEM_1(a) memset((a),-1,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define COMPRESS(a) sort(ALL(a));a.resize(unique(ALL(a))-a.begin())
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<ld> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 };
#include "Anthony.h"
Vi Mark(int N, int M, int A, int B, Vi U, Vi V){
vector<Vi> v(N);
fup(i,0,M-1,1){
v[U[i]].pb(V[i]);
v[V[i]].pb(U[i]);
}
Vi res(M);
if(A==2){
}else{
Vi d(N,-1);
queue<int> q;
q.push(0);
d[0]=0;
while(!q.empty()){
int x=q.front();
q.pop();
for(int y:v[x]){
if(d[y]==-1){
d[y]=d[x]+1;
q.push(y);
}
}
}
fup(i,0,M-1,1){
int t=min(d[U[i]],d[V[i]]);
res[i]=t%3;
}
}
return res;
}
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a))
#define MEM_1(a) memset((a),-1,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define COMPRESS(a) sort(ALL(a));a.resize(unique(ALL(a))-a.begin())
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<ld> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 };
#include "Catherine.h"
namespace{
int a,b;
}
void Init(int A,int B){
a=A,b=B;
}
int Move(Vi y){
if(a==2){
return -1;
}else{
if(y[0]==0 && y[1]==0)return 2;
if(y[0]==0 && y[2]==0)return 1;
if(y[1]==0 && y[2]==0)return 0;
fup(j,0,2,1)if(y[j]==0)return (j+1)%3;
return -1;
}
}
Compilation message
Anthony.cpp: In function 'Vi Mark(int, int, int, int, Vi, Vi)':
Anthony.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
| ^
Anthony.cpp:47:2: note: in expansion of macro 'fup'
47 | fup(i,0,M-1,1){
| ^~~
Anthony.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
| ^
Anthony.cpp:69:3: note: in expansion of macro 'fup'
69 | fup(i,0,M-1,1){
| ^~~
Catherine.cpp: In function 'int Move(Vi)':
Catherine.cpp:10:30: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
| ^
Catherine.cpp:59:3: note: in expansion of macro 'fup'
59 | fup(j,0,2,1)if(y[j]==0)return (j+1)%3;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
15328 KB |
Output is correct |
2 |
Correct |
0 ms |
484 KB |
Output is correct |
3 |
Correct |
36 ms |
14716 KB |
Output is correct |
4 |
Correct |
55 ms |
16464 KB |
Output is correct |
5 |
Correct |
53 ms |
16412 KB |
Output is correct |
6 |
Correct |
48 ms |
15048 KB |
Output is correct |
7 |
Correct |
42 ms |
15136 KB |
Output is correct |
8 |
Correct |
51 ms |
15792 KB |
Output is correct |
9 |
Correct |
57 ms |
15984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
15328 KB |
Output is correct |
2 |
Correct |
0 ms |
484 KB |
Output is correct |
3 |
Correct |
36 ms |
14716 KB |
Output is correct |
4 |
Correct |
55 ms |
16464 KB |
Output is correct |
5 |
Correct |
53 ms |
16412 KB |
Output is correct |
6 |
Correct |
48 ms |
15048 KB |
Output is correct |
7 |
Correct |
42 ms |
15136 KB |
Output is correct |
8 |
Correct |
51 ms |
15792 KB |
Output is correct |
9 |
Correct |
57 ms |
15984 KB |
Output is correct |
10 |
Correct |
39 ms |
13144 KB |
Output is correct |
11 |
Correct |
39 ms |
13220 KB |
Output is correct |
12 |
Correct |
46 ms |
13252 KB |
Output is correct |
13 |
Correct |
39 ms |
13160 KB |
Output is correct |
14 |
Correct |
49 ms |
13416 KB |
Output is correct |
15 |
Correct |
45 ms |
13880 KB |
Output is correct |
16 |
Correct |
49 ms |
15968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
12968 KB |
Output is correct |
2 |
Correct |
0 ms |
488 KB |
Output is correct |
3 |
Correct |
36 ms |
12556 KB |
Output is correct |
4 |
Correct |
53 ms |
14336 KB |
Output is correct |
5 |
Correct |
57 ms |
14312 KB |
Output is correct |
6 |
Correct |
41 ms |
13028 KB |
Output is correct |
7 |
Correct |
43 ms |
13108 KB |
Output is correct |
8 |
Correct |
48 ms |
13532 KB |
Output is correct |
9 |
Correct |
49 ms |
13660 KB |
Output is correct |
10 |
Correct |
53 ms |
13360 KB |
Output is correct |
11 |
Correct |
50 ms |
13368 KB |
Output is correct |
12 |
Correct |
48 ms |
13352 KB |
Output is correct |
13 |
Correct |
46 ms |
13372 KB |
Output is correct |
14 |
Correct |
48 ms |
13644 KB |
Output is correct |
15 |
Correct |
49 ms |
13568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
12968 KB |
Output is correct |
2 |
Correct |
0 ms |
488 KB |
Output is correct |
3 |
Correct |
36 ms |
12556 KB |
Output is correct |
4 |
Correct |
53 ms |
14336 KB |
Output is correct |
5 |
Correct |
57 ms |
14312 KB |
Output is correct |
6 |
Correct |
41 ms |
13028 KB |
Output is correct |
7 |
Correct |
43 ms |
13108 KB |
Output is correct |
8 |
Correct |
48 ms |
13532 KB |
Output is correct |
9 |
Correct |
49 ms |
13660 KB |
Output is correct |
10 |
Correct |
53 ms |
13360 KB |
Output is correct |
11 |
Correct |
50 ms |
13368 KB |
Output is correct |
12 |
Correct |
48 ms |
13352 KB |
Output is correct |
13 |
Correct |
46 ms |
13372 KB |
Output is correct |
14 |
Correct |
48 ms |
13644 KB |
Output is correct |
15 |
Correct |
49 ms |
13568 KB |
Output is correct |
16 |
Correct |
41 ms |
11276 KB |
Output is correct |
17 |
Correct |
36 ms |
11356 KB |
Output is correct |
18 |
Correct |
40 ms |
11308 KB |
Output is correct |
19 |
Correct |
41 ms |
11316 KB |
Output is correct |
20 |
Correct |
52 ms |
11856 KB |
Output is correct |
21 |
Correct |
40 ms |
11632 KB |
Output is correct |
22 |
Correct |
51 ms |
13784 KB |
Output is correct |
23 |
Correct |
40 ms |
11312 KB |
Output is correct |
24 |
Correct |
40 ms |
11352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
884 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
10684 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
10608 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |