답안 #829620

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829620 2023-08-18T13:25:05 Z NemanjaSo2005 길고양이 (JOI20_stray) C++17
15 / 100
44 ms 16648 KB
#include "Anthony.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<int> graf[20005];
int dist[20005];
queue<int> Q;
int N;
bool prosli[20005];
void BFS(int gde){
   for(int i=0;i<=N;i++)
      dist[i]=-1;
   dist[gde]=0;
   Q.push(gde);
   while(Q.size()){
      int tren=Q.front();
      Q.pop();
      if(prosli[tren])
         continue;
      //cout<<tren<<endl;
      prosli[tren]=true;
      for(int i=0;i<graf[tren].size();i++)
         if(dist[graf[tren][i]]==-1){
            dist[graf[tren][i]]=dist[tren]+1;
            Q.push(graf[tren][i]);
         }
   }
   return;
}
vector<int> Mark(int n, int M, int A, int B, vector<int> U,vector<int> V) {
   N=n;
   for(int i=0;i<M;i++){
      graf[U[i]].push_back(V[i]);
      graf[V[i]].push_back(U[i]);
   }
   BFS(0);
   /*for(int i=0;i<N;i++)
      cout<<dist[i]<<" ";
   cout<<endl;*/
   if(B>=6 and M==N-1){
      string S="001011";
      vector<int> R;
      for(int i=0;i<M;i++){
         int md=min(dist[U[i]],dist[V[i]]);
         R.push_back(S[md%6]-'0');
      }
      return R;
   }
   string S="012";
   vector<int> R;
   for(int i=0;i<M;i++){
      int md=min(dist[U[i]],dist[V[i]]);
      R.push_back(S[md%3]-'0');
   }
   return R;
}
#include "Catherine.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int slucaj;
void Init(int A, int B) {
   if(A==2)
      slucaj=2;
   else
      slucaj=1;
}
int Move(std::vector<int> y) {
   if(slucaj==1){
      if(y[0]==0 and y[1]==0)
         return 2;
      if(y[0]==0 and y[2]==0)
         return 1;
      if(y[1]==0 and y[2]==0)
         return 0;
      if(y[0]==0)
         return 1;
      if(y[1]==0)
         return 2;
      return 0;
   }
   exit(-1);
}

Compilation message

Anthony.cpp: In function 'void BFS(int)':
Anthony.cpp:22:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |       for(int i=0;i<graf[tren].size();i++)
      |                   ~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 15396 KB Output is correct
2 Correct 1 ms 1024 KB Output is correct
3 Correct 26 ms 14792 KB Output is correct
4 Correct 44 ms 16588 KB Output is correct
5 Correct 38 ms 16648 KB Output is correct
6 Correct 27 ms 15252 KB Output is correct
7 Correct 36 ms 15340 KB Output is correct
8 Correct 37 ms 15996 KB Output is correct
9 Correct 43 ms 15976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 15396 KB Output is correct
2 Correct 1 ms 1024 KB Output is correct
3 Correct 26 ms 14792 KB Output is correct
4 Correct 44 ms 16588 KB Output is correct
5 Correct 38 ms 16648 KB Output is correct
6 Correct 27 ms 15252 KB Output is correct
7 Correct 36 ms 15340 KB Output is correct
8 Correct 37 ms 15996 KB Output is correct
9 Correct 43 ms 15976 KB Output is correct
10 Correct 28 ms 13268 KB Output is correct
11 Correct 25 ms 13400 KB Output is correct
12 Correct 28 ms 13412 KB Output is correct
13 Correct 26 ms 13424 KB Output is correct
14 Correct 26 ms 13660 KB Output is correct
15 Correct 27 ms 13940 KB Output is correct
16 Correct 30 ms 16080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13136 KB Output is correct
2 Correct 1 ms 1024 KB Output is correct
3 Correct 26 ms 12644 KB Output is correct
4 Correct 35 ms 14484 KB Output is correct
5 Correct 34 ms 14460 KB Output is correct
6 Correct 32 ms 13176 KB Output is correct
7 Correct 28 ms 13088 KB Output is correct
8 Correct 30 ms 13764 KB Output is correct
9 Correct 28 ms 13780 KB Output is correct
10 Correct 30 ms 13480 KB Output is correct
11 Correct 34 ms 13504 KB Output is correct
12 Correct 31 ms 13492 KB Output is correct
13 Correct 27 ms 13488 KB Output is correct
14 Correct 30 ms 13928 KB Output is correct
15 Correct 33 ms 13860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13136 KB Output is correct
2 Correct 1 ms 1024 KB Output is correct
3 Correct 26 ms 12644 KB Output is correct
4 Correct 35 ms 14484 KB Output is correct
5 Correct 34 ms 14460 KB Output is correct
6 Correct 32 ms 13176 KB Output is correct
7 Correct 28 ms 13088 KB Output is correct
8 Correct 30 ms 13764 KB Output is correct
9 Correct 28 ms 13780 KB Output is correct
10 Correct 30 ms 13480 KB Output is correct
11 Correct 34 ms 13504 KB Output is correct
12 Correct 31 ms 13492 KB Output is correct
13 Correct 27 ms 13488 KB Output is correct
14 Correct 30 ms 13928 KB Output is correct
15 Correct 33 ms 13860 KB Output is correct
16 Correct 23 ms 11524 KB Output is correct
17 Correct 24 ms 11404 KB Output is correct
18 Correct 24 ms 11504 KB Output is correct
19 Correct 24 ms 11488 KB Output is correct
20 Correct 26 ms 12076 KB Output is correct
21 Correct 30 ms 11892 KB Output is correct
22 Correct 28 ms 13932 KB Output is correct
23 Correct 27 ms 11564 KB Output is correct
24 Correct 25 ms 11628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 1292 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 22 ms 11196 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 22 ms 11088 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -