Submission #565934

# Submission time Handle Problem Language Result Execution time Memory
565934 2022-05-21T14:57:17 Z errorgorn Stray Cat (JOI20_stray) C++17
15 / 100
50 ms 17120 KB
#include "Anthony.h"

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ii pair<int,int>
#define fi first
#define se second

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (int x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

namespace {
	bool st;
	int n,m;
	vector<int> al[20005];
	
	int w[20005];
	queue<int> q;
}

vector<signed> Mark(signed N, signed M, signed A, signed B,
                      vector<signed> U, vector<signed> V) {
						  
	
	st=(A>=3);
	n=N,m=M;
	
	if (st){
		rep(x,0,m){
			al[U[x]].pub(V[x]);
			al[V[x]].pub(U[x]);
		}
		
		memset(w,-1,sizeof(w));
		q.push(0);
		w[0]=0;
		
		while (!q.empty()){
			int u=q.front(); q.pop();
			for (auto it:al[u]) if (w[it]==-1){
				w[it]=w[u]+1;
				q.push(it);
			}
		}
		
		vector<signed> res;
		rep(x,0,m){
			res.pub(min(w[U[x]],w[V[x]])%3);
			//cout<<res.back()<<" "<<U[x]<<" "<<V[x]<<endl;
		}
		return res;
	}
	else{
		return {};
	}
}
#include "Catherine.h"

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ii pair<int,int>
#define fi first
#define se second

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (int x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

namespace {
	bool st;
	int PREV=-1;
}

void Init(signed A, signed B) {
	st=(A>=3);
}

signed Move(vector<signed> y) {
	if (st){
		vector<int> v;
		rep(x,0,3) if (y[x] || PREV==x) v.pub(x);
		sort(all(v));
		
		if (sz(v)==1){
			return PREV=v[0];
		}
		else if (v[1]==1){
			return PREV=0;
		}
		else if (v[0]==1){
			return PREV=1;
		}
		else{
			return PREV=2;
		}
	}
	else{
		return 69;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 38 ms 15676 KB Output is correct
2 Correct 1 ms 1244 KB Output is correct
3 Correct 33 ms 15012 KB Output is correct
4 Correct 50 ms 17080 KB Output is correct
5 Correct 49 ms 17120 KB Output is correct
6 Correct 34 ms 16012 KB Output is correct
7 Correct 36 ms 15892 KB Output is correct
8 Correct 45 ms 16552 KB Output is correct
9 Correct 41 ms 16528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 15676 KB Output is correct
2 Correct 1 ms 1244 KB Output is correct
3 Correct 33 ms 15012 KB Output is correct
4 Correct 50 ms 17080 KB Output is correct
5 Correct 49 ms 17120 KB Output is correct
6 Correct 34 ms 16012 KB Output is correct
7 Correct 36 ms 15892 KB Output is correct
8 Correct 45 ms 16552 KB Output is correct
9 Correct 41 ms 16528 KB Output is correct
10 Correct 32 ms 13960 KB Output is correct
11 Correct 33 ms 13936 KB Output is correct
12 Correct 32 ms 14052 KB Output is correct
13 Correct 32 ms 14044 KB Output is correct
14 Correct 38 ms 14176 KB Output is correct
15 Correct 40 ms 14660 KB Output is correct
16 Correct 40 ms 16632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 13152 KB Output is correct
2 Correct 0 ms 1152 KB Output is correct
3 Correct 31 ms 12800 KB Output is correct
4 Correct 47 ms 14956 KB Output is correct
5 Correct 50 ms 14956 KB Output is correct
6 Correct 34 ms 13828 KB Output is correct
7 Correct 36 ms 13640 KB Output is correct
8 Correct 40 ms 14252 KB Output is correct
9 Correct 39 ms 14216 KB Output is correct
10 Correct 38 ms 13992 KB Output is correct
11 Correct 37 ms 14020 KB Output is correct
12 Correct 44 ms 14024 KB Output is correct
13 Correct 38 ms 14156 KB Output is correct
14 Correct 41 ms 14372 KB Output is correct
15 Correct 39 ms 14352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 13152 KB Output is correct
2 Correct 0 ms 1152 KB Output is correct
3 Correct 31 ms 12800 KB Output is correct
4 Correct 47 ms 14956 KB Output is correct
5 Correct 50 ms 14956 KB Output is correct
6 Correct 34 ms 13828 KB Output is correct
7 Correct 36 ms 13640 KB Output is correct
8 Correct 40 ms 14252 KB Output is correct
9 Correct 39 ms 14216 KB Output is correct
10 Correct 38 ms 13992 KB Output is correct
11 Correct 37 ms 14020 KB Output is correct
12 Correct 44 ms 14024 KB Output is correct
13 Correct 38 ms 14156 KB Output is correct
14 Correct 41 ms 14372 KB Output is correct
15 Correct 39 ms 14352 KB Output is correct
16 Correct 31 ms 12192 KB Output is correct
17 Correct 28 ms 12212 KB Output is correct
18 Correct 32 ms 12156 KB Output is correct
19 Correct 30 ms 12104 KB Output is correct
20 Correct 38 ms 12700 KB Output is correct
21 Correct 36 ms 12480 KB Output is correct
22 Correct 40 ms 14512 KB Output is correct
23 Correct 31 ms 12320 KB Output is correct
24 Correct 32 ms 12140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1032 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1284 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1272 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -