Submission #829894

#TimeUsernameProblemLanguageResultExecution timeMemory
829894RifalStray Cat (JOI20_stray)C++14
15 / 100
45 ms16600 KiB
#include<bits/stdc++.h> #include "Anthony.h" #include <vector> using namespace std; namespace { const int Max = 2e4 + 5; vector<int> v[Max]; int level[Max]; void bfs(int s) { queue<int> q; q.push(s); level[s] = 1; while(!q.empty()) { int fron = q.front(); q.pop(); for(auto i : v[fron]) { if(level[i] == 0) { level[i] = level[fron] + 1; q.push(i); } else if(level[i] > level[fron]+1){ level[i] = level[fron] + 1; q.push(i); } } } } } vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) { vector<int> x; for(int i = 0; i < M; i++) { v[U[i]].push_back(V[i]); v[V[i]].push_back(U[i]); } bfs(0); for(int i = 0; i < M; i++) { int a = min(level[U[i]]%3,level[V[i]]%3), b = max(level[U[i]]%3,level[V[i]]%3); if(a == 1 && b == 2) x.push_back(1); else if(a == 0 && b == 2) x.push_back(2); else if(a == 0 && b == 1) x.push_back(0); else if(a == b) x.push_back(a); } return x; }
#include "Catherine.h" #include <vector> using namespace std; namespace { int A, B; int variable_example = 0; } // namespace void Init(int A, int B) { ::A = A; ::B = B; } int Move(vector<int> y) { ++variable_example; int a = 10, b = -1; for (int i = 0; i < A; ++i) { if(y[i] != 0) { a = min(a,i); b = max(b,i); } } if(a == 0 && b == 1) return 0; else if(a == 1 && b == 2) return 1; else if(a == 0 && b == 2) return 2; else if(a == b) return a; }

Compilation message (stderr)

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...