답안 #939530

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
939530 2024-03-06T12:59:08 Z pcc 길고양이 (JOI20_stray) C++14
15 / 100
37 ms 17352 KB
#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>


namespace ANTHONY{

#define pii pair<int,int>
#define fs first
#define sc second
	using namespace std;
	const int mxn = 2e4+10;
	int N,M;
	vector<pii> paths[mxn];
	vector<pii> edges;
	namespace S1{
		queue<int> q;
		int dist[mxn];
		void BFS(){
			memset(dist,-1,sizeof(dist));
			dist[0] = 0;
			q.push(0);
			while(!q.empty()){
				auto now = q.front();
				q.pop();
				for(auto nxt:paths[now]){
					if(dist[nxt.fs] == -1)dist[nxt.fs] = dist[now]+1,q.push(nxt.fs);
				}
			}
			return;
		}
		vector<int> GO(){
			//cout<<"CASE 1"<<endl;
			vector<int> ans(M,0);
			BFS();
			for(int i = 0;i<M;i++){
				auto [a,b] = edges[i];
				if(dist[a]>dist[b])swap(a,b);
				if(dist[a]==dist[b])ans[i] = (dist[a]+1)%3;
				else ans[i] = dist[b]%3;
				//cout<<a<<' '<<b<<" "<<ans[i]<<endl;
			}
			//for(int i = 0;i<N;i++)cout<<dist[i]<<' ';cout<<endl;
			//cout<<ans.size()<<endl;
			//for(auto &i:ans)cout<<i;cout<<endl;
			return ans;
		}
	}
	namespace S2{
		void BFS(){
		}
		vector<int> GO(){
			return vector<int>(M);
		}
	}
	vector<int> SOLVE(int n,int m,int a,int b,vector<int> va,vector<int> vb){
		N = n,M = m;
		for(int i = 0;i<m;i++){
			edges.push_back({va[i],vb[i]});
			paths[va[i]].push_back({vb[i],i});
			paths[vb[i]].push_back({va[i],i});
		}
		if(a>=3)return S1::GO();
		else return S2::GO();
	}
}  // namespace

std::vector<int> Mark(int N, int M, int A, int B,
                      std::vector<int> U, std::vector<int> V) {
  return ANTHONY::SOLVE(N,M,A,B,U,V);
}
#include "Catherine.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fs first
#define sc second

namespace NEKO{

int task;
vector<int> route;

}  // namespace

void Init(int A, int B) {
	NEKO::task = (A<=2);
	return;
}

namespace S1{
	int GO(vector<int> v){
		//cout<<"CAT 1"<<endl;
		int sum = 0;
		//for(auto &i:v)cout<<i;cout<<endl;
		for(auto &i:v)sum += (i?1:0);
		if(sum == 1)return max_element(v.begin(),v.end())-v.begin();
		int s = 0;
		for(int i = 0;i<3;i++){
			if(v[i])s ^= i;
		}
		switch(s){
			case 1:
				return 0;
			case 2:
				return 2;
			case 3:
				return 1;
		}
		assert(false);
		return -1;
	}
}

namespace S2{
	int GO(vector<int> v){
		//cout<<"CAT 2"<<endl;
		return 0;
	}
}

int Move(std::vector<int> y) {
	if(NEKO::task)return S2::GO(y);
	else return S1::GO(y);
}

Compilation message

Anthony.cpp: In function 'std::vector<int> ANTHONY::S1::GO()':
Anthony.cpp:37:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   37 |     auto [a,b] = edges[i];
      |          ^
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 16132 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 26 ms 15736 KB Output is correct
4 Correct 37 ms 17352 KB Output is correct
5 Correct 36 ms 17316 KB Output is correct
6 Correct 30 ms 16116 KB Output is correct
7 Correct 30 ms 16196 KB Output is correct
8 Correct 33 ms 16792 KB Output is correct
9 Correct 32 ms 16820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 16132 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 26 ms 15736 KB Output is correct
4 Correct 37 ms 17352 KB Output is correct
5 Correct 36 ms 17316 KB Output is correct
6 Correct 30 ms 16116 KB Output is correct
7 Correct 30 ms 16196 KB Output is correct
8 Correct 33 ms 16792 KB Output is correct
9 Correct 32 ms 16820 KB Output is correct
10 Correct 25 ms 14288 KB Output is correct
11 Correct 26 ms 14088 KB Output is correct
12 Correct 27 ms 14236 KB Output is correct
13 Correct 26 ms 14248 KB Output is correct
14 Correct 27 ms 14548 KB Output is correct
15 Correct 31 ms 14792 KB Output is correct
16 Correct 32 ms 16852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 13316 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 23 ms 13516 KB Output is correct
4 Correct 37 ms 15136 KB Output is correct
5 Correct 33 ms 15304 KB Output is correct
6 Correct 27 ms 13864 KB Output is correct
7 Correct 27 ms 13872 KB Output is correct
8 Correct 31 ms 14472 KB Output is correct
9 Correct 32 ms 14428 KB Output is correct
10 Correct 28 ms 14292 KB Output is correct
11 Correct 37 ms 14292 KB Output is correct
12 Correct 28 ms 14496 KB Output is correct
13 Correct 28 ms 14228 KB Output is correct
14 Correct 31 ms 14468 KB Output is correct
15 Correct 31 ms 14564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 13316 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 23 ms 13516 KB Output is correct
4 Correct 37 ms 15136 KB Output is correct
5 Correct 33 ms 15304 KB Output is correct
6 Correct 27 ms 13864 KB Output is correct
7 Correct 27 ms 13872 KB Output is correct
8 Correct 31 ms 14472 KB Output is correct
9 Correct 32 ms 14428 KB Output is correct
10 Correct 28 ms 14292 KB Output is correct
11 Correct 37 ms 14292 KB Output is correct
12 Correct 28 ms 14496 KB Output is correct
13 Correct 28 ms 14228 KB Output is correct
14 Correct 31 ms 14468 KB Output is correct
15 Correct 31 ms 14564 KB Output is correct
16 Correct 23 ms 12544 KB Output is correct
17 Correct 25 ms 12340 KB Output is correct
18 Correct 25 ms 12208 KB Output is correct
19 Correct 27 ms 12144 KB Output is correct
20 Correct 27 ms 13076 KB Output is correct
21 Correct 27 ms 12656 KB Output is correct
22 Correct 30 ms 15312 KB Output is correct
23 Correct 26 ms 12492 KB Output is correct
24 Correct 25 ms 12480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1556 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 11108 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 11004 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -