Submission #912744

# Submission time Handle Problem Language Result Execution time Memory
912744 2024-01-19T19:48:36 Z amirhoseinfar1385 Stray Cat (JOI20_stray) C++17
0 / 100
3000 ms 10772 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn=20000+10;
struct yal{
	int u,v,w;	
	int getad(int fu){
		return (fu^u^v);
	}
}alle[maxn];
int a,b,n,m,high[maxn];
vector<int>res;
vector<int>adj[maxn];

void bfs(int u){
	vector<int>bf;
	bf.push_back(u);
	int dis=1;
	while((int)bf.size()>0){
		for(auto x:bf){
			high[x]=dis;
		}
		vector<int>fake;
		for(auto x:bf){
			for(auto y:adj[x]){
				int v=alle[y].getad(x);
				if(high[v]==0){
					high[v]=dis+1;
					fake.push_back(v);
				}
			}
		}
		dis++;
	}
}

vector<int> Mark(int N, int M, int A, int B,std::vector<int> U, std::vector<int> V) {
  	a=A;
  	b=B;
  	n=N;
  	m=M;
  	res.resize(m);
  	for(int i=0;i<m;i++){
  		cin>>alle[i].u>>alle[i].v;
  		adj[alle[i].u].push_back(i);
  		adj[alle[i].v].push_back(i);
  	}
  	if(a>=3){
  		bfs(1);
  		for(int i=0;i<m;i++){
  			if(high[alle[i].u]>high[alle[i].v]){
  				swap(alle[i].u,alle[i].v);
  			}
  			res[i]=high[alle[i].v]%3;
  		}
  		return res;
  	}
  	return res;
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;
int a,b;

void Init(int A, int B) {
  a=A;
  b=B;
}

int Move(std::vector<int> y) {
  if(a>=3){
    vector<int>tof;
    for(int i=0;i<(int)y.size();i++){
      if(y[i]!=0){
        tof.push_back(i);
      }
    }
    if((int)tof.size()==0){
      return -1;
    }
    if((int)tof.size()==1){
      return tof[0];
    }
    if(tof[0]==0&&tof[1]==1){
      return 0;
    }
    if(tof[0]==0&&tof[1]==2){
      return 2;
    }
    if(tof[0]==1&&tof[1]==2){
      return 1;
    }
  }
  return -1;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3012 ms 1884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3012 ms 1884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3057 ms 1788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3057 ms 1788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1560 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 10772 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 10708 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -