Submission #1081460

#TimeUsernameProblemLanguageResultExecution timeMemory
1081460thelegendary08Stray Cat (JOI20_stray)C++14
15 / 100
46 ms18296 KiB
#include "Anthony.h" #include <bits/stdc++.h> #define f0r(i,n) for(int i = 0; i<n;i++) #define vi vector<int> #define pb push_back using namespace std; std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) { std::vector<int> ret(M, -1); vector<pair<int,int>>edges; vector<int>adj[N]; f0r(i, M){ edges.pb({min(U[i], V[i]), max(U[i], V[i])}); adj[U[i]].pb(V[i]); adj[V[i]].pb(U[i]); } map<pair<int,int>,int>m; f0r(i, M){ m[edges[i]] = i; } /* vi dist(N, 1e9); dist[0] = 0; priority_queue<pair<int,int>>q; q.push({0, 0}); while(!q.empty()){ int node = q.top().second; q.pop(); for(auto u : adj[node]){ if(dist[u] > dist[node] + 1){ dist[u] = dist[node] + 1; q.push({-dist[u], u]}); } } } */ vi dist(N, 1e9); dist[0] = 0; queue<int>q; q.push(0); while(!q.empty()){ int node = q.front(); q.pop(); for(auto u : adj[node]){ if(dist[u] == 1e9){ ret[m[{min(u, node), max(u, node)}]] = dist[node] % 3; dist[u] = dist[node] + 1; q.push(u); } } } f0r(i, M){ if(ret[i] == -1){ ret[i] = min(dist[edges[i].first], dist[edges[i].second]) % 3; } } return ret; }
#include "Catherine.h" #include <bits/stdc++.h> #define f0r(i,n) for(int i = 0; i< n; i++) #define pb push_back #define vi vector<int> using namespace std; int A, B; void Init(int A, int B) { ::A = A; ::B = B; } int Move(std::vector<int> y) { //set<int>s; vector<int>has; f0r(i, A){ if(y[i] != 0){ has.pb(i); } } sort(has.begin(), has.end()); if(has.size() == 1){ return has[0]; } else{ if(has[0] == 0 && has[1] == 1)return 0; if(has[0] == 1 && has[1] == 2)return 1; return 2; } }
#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...