Submission #947427

#TimeUsernameProblemLanguageResultExecution timeMemory
947427phoenix0423Stray Cat (JOI20_stray)C++17
0 / 100
24 ms11304 KiB
#include<bits/stdc++.h> using namespace std; typedef pair<int, int> pll; #define pb push_back #define eb emplace_back const int INF = 1e9; #include "Anthony.h" vector<int> Mark(int n, int m, int a, int b, vector<int> u, vector<int> v){ vector<vector<pll>> adj(n); vector<int> dist(n, INF), deg(n); dist[0] = 0; for(int i = 0; i < m; i++){ adj[u[i]].eb(v[i], i); adj[v[i]].eb(u[i], i); deg[u[i]] ++, deg[v[i]] ++; } vector<int> color(m, -1); vector<int> bd(n); bd[0] = 0; queue<pll> q; q.push({0, 0}); if(a >= 3){ while(!q.empty()){ auto [pos, lst] = q.front(); q.pop(); for(auto [x, id] : adj[pos]){ if(color[id] != -1) continue; if(dist[x] != INF){ if(dist[x] >= dist[pos]) color[id] = (lst + 1) % a; else color[id] = lst; continue; } // cout<<"do : "<<pos<<" "<<x<<" "<<lst<<"\n"; dist[x] = dist[pos] + 1; color[id] = (lst + 1) % a; q.push({x, color[id]}); } } cout<<"dist : "; for(auto x : dist) cout<<x<<" "; cout<<"\n"; } else{ string ck = "121221"; while(!q.empty()){ auto [pos, lst] = q.front(); q.pop(); int put; if(deg[pos] > 2){ if(ck[lst] == '1') put = 1; else put = 0; } else put = (lst + 1) % 6; for(auto [x, id] : adj[pos]){ if(dist[x] != INF) continue; dist[x] = dist[pos] + 1; color[id] = (ck[put] - '1'); q.push({x, put}); } } } return color; } // signed main(void){ // int n, m, a, b, s; // cin>>n>>m>>a>>b>>s; // vector<int> u(m), v(m); // for(int i = 0; i < m; i++) cin>>u[i]>>v[i]; // auto c = Mark(n, m, a, b, u, v); // for(auto x : c) cout<<x<<" "; // cout<<"\n"; // }
#include "Catherine.h" #include <vector> #include<bits/stdc++.h> using namespace std; int A, B, lst = -1, move = 0, ok = 0; string ps = ""; void Init(int a, int b){ A = a, B = b; } int Move(vector<int> y){ // cout<<"ck : "<<A<<" "<<B<<"\n"; if(lst != -1) y[lst]++; int deg = accumulate(y.begin(), y.end(), 0); if(deg == 1){ return max_element(y.begin(), y.end()) - y.begin(); } if(true){ for(int i = 0; i < A; i++){ // cout<<"try : "<<y[i]<<" "<<y[(i + 1) % A]<<"\n"; if(y[i] == 1 && y[(i + 1) % A]){ return i; } } } return 0; if(deg > 2){ if(lst) return lst ^ 1; else return y[0] != 1; } if(ok){ } } /* 7 6 3 6 1 0 2 0 4 1 2 1 3 1 5 4 6 */
#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...