Submission #912750

# Submission time Handle Problem Language Result Execution time Memory
912750 2024-01-19T20:07:10 Z amirhoseinfar1385 Stray Cat (JOI20_stray) C++17
4 / 100
43 ms 17348 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];

namespace {
	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);
				}
			}
		}
		swap(fake,bf);
		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++){
 		alle[i].u=U[i];
 		alle[i].v=V[i]; 		
  		adj[alle[i].u].push_back(i);
  		adj[alle[i].v].push_back(i);
  	}
  	if(a>=3){
  		bfs(0);
  		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;

namespace {
  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 Correct 33 ms 15908 KB Output is correct
2 Correct 1 ms 1552 KB Output is correct
3 Correct 26 ms 15592 KB Output is correct
4 Correct 43 ms 17348 KB Output is correct
5 Correct 37 ms 17156 KB Output is correct
6 Correct 33 ms 16224 KB Output is correct
7 Correct 31 ms 16192 KB Output is correct
8 Correct 36 ms 16628 KB Output is correct
9 Correct 35 ms 16724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 15908 KB Output is correct
2 Correct 1 ms 1552 KB Output is correct
3 Correct 26 ms 15592 KB Output is correct
4 Correct 43 ms 17348 KB Output is correct
5 Correct 37 ms 17156 KB Output is correct
6 Correct 33 ms 16224 KB Output is correct
7 Correct 31 ms 16192 KB Output is correct
8 Correct 36 ms 16628 KB Output is correct
9 Correct 35 ms 16724 KB Output is correct
10 Incorrect 25 ms 13984 KB Wrong Answer [6]
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 13432 KB Output is correct
2 Correct 1 ms 1300 KB Output is correct
3 Correct 24 ms 13324 KB Output is correct
4 Correct 36 ms 15204 KB Output is correct
5 Correct 35 ms 15344 KB Output is correct
6 Correct 28 ms 13624 KB Output is correct
7 Correct 38 ms 14092 KB Output is correct
8 Correct 32 ms 14276 KB Output is correct
9 Correct 34 ms 14368 KB Output is correct
10 Correct 30 ms 14156 KB Output is correct
11 Correct 34 ms 14092 KB Output is correct
12 Correct 35 ms 14320 KB Output is correct
13 Correct 32 ms 14600 KB Output is correct
14 Correct 32 ms 14412 KB Output is correct
15 Correct 33 ms 14412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 13432 KB Output is correct
2 Correct 1 ms 1300 KB Output is correct
3 Correct 24 ms 13324 KB Output is correct
4 Correct 36 ms 15204 KB Output is correct
5 Correct 35 ms 15344 KB Output is correct
6 Correct 28 ms 13624 KB Output is correct
7 Correct 38 ms 14092 KB Output is correct
8 Correct 32 ms 14276 KB Output is correct
9 Correct 34 ms 14368 KB Output is correct
10 Correct 30 ms 14156 KB Output is correct
11 Correct 34 ms 14092 KB Output is correct
12 Correct 35 ms 14320 KB Output is correct
13 Correct 32 ms 14600 KB Output is correct
14 Correct 32 ms 14412 KB Output is correct
15 Correct 33 ms 14412 KB Output is correct
16 Incorrect 23 ms 12256 KB Wrong Answer [6]
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1552 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 11120 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 10876 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -