Submission #829836

#TimeUsernameProblemLanguageResultExecution timeMemory
829836birthdaycakeStray Cat (JOI20_stray)C++14
4 / 100
40 ms20808 KiB
#include "Anthony.h" #include<bits/stdc++.h> using namespace std; vector<int>adj[200001]; int depth[200001],col[200001]; vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) { for(int i = 0; i < N; i++) { adj[i].clear(); depth[i] = 1e9; } for(int i = 0; i < M; i++){ adj[U[i]].push_back(V[i]); adj[V[i]].push_back(U[i]); } priority_queue<pair<int,int>>d; d.push({0,0}); depth[0] = 0; while(d.size()){ auto x = d.top(); d.pop(); x.first *= -1; if(depth[x.second] < x.first) continue; for(auto s: adj[x.second]){ if(x.first + 1 < depth[s]){ depth[s] = x.first + 1; d.push({-depth[s], s}); } } } vector<int>ans; for(int i = 0; i < M; i++){ ans.push_back(max(depth[U[i]], depth[V[i]]) % 3); } return ans; }
#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(vector<int> y) { set<int>p; int col = 0; for(auto s: y) { if(s > 0) p.insert(col); col++; } auto xx = *p.begin(); p.erase(p.begin()); if(p.empty()) return xx; if(xx == 0 and *p.begin() == 1) return 0; if(xx == 1 and *p.begin() == 2) return 1; if(xx == 0 and *p.begin() == 2) return 2; return -1; }
#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...