Submission #1005130

#TimeUsernameProblemLanguageResultExecution timeMemory
1005130onbertStray Cat (JOI20_stray)C++17
100 / 100
38 ms16556 KiB
#include "Anthony.h" #include <bits/stdc++.h> using namespace std; vector<int> Mark(int n, int m, int A, int b, vector<int> U, vector<int> V) { vector<pair<int,int>> adj[n]; // cout << "test" << endl; for (int i=0;i<m;i++) adj[U[i]].push_back({V[i], i}), adj[V[i]].push_back({U[i], i}); int a[6] = {1, 0, 1, 0, 0, 1}; int vis[n]; for (int i=0;i<n;i++) vis[i] = -1; queue<int> Q; vis[0] = 0; Q.push(0); vector<int> ans(m, -1); while (Q.size() > 0) { int u = Q.front(); for (auto [v, id]:adj[u]) { if (A!=2 && vis[v] != (vis[u]+2)%3) ans[id] = vis[u]; if (vis[v] != -1) continue; if (A==2) { if (adj[u].size()<=2) vis[v] = (vis[u]+1)%6; else vis[v] = a[vis[u]]; ans[id] = a[vis[v]]; } else { vis[v] = (vis[u]+1)%3; ans[id] = vis[u]; } Q.push(v); } Q.pop(); } return ans; }
#include "Catherine.h" #include <bits/stdc++.h> using namespace std; int A; int move(vector<int> v); void Init(int AA, int B) { A = AA; } int cnt = 0, a[6] = {1, 0, 1, 0, 0, 1}; bool homerun = false; int last = -1; vector<int> track; int Move(vector<int> v) { if (A!=2) return move(v); cnt++; if (homerun) { if (v[0] + v[1] == 1) { for (int i=0;i<A;i++) if (v[i]) { last = i; return i; } } else { v[last]++; for (int i=0;i<A;i++) if (v[i]==1) { if (i==last) return -1; else { last = i; return i; } } } } if (cnt==1) { if (v[0] + v[1] == 2) { if (v[0]==2) { track = {0, 0}; last = 0; return 0; } if (v[1]==2) { track = {1, 1}; last = 1; return 1; } if (v[0]==1 && v[1]==1) { track = {1, 0}; last = 0; return 0; } } homerun = true; for (int i=0;i<A;i++) if (v[i]==1) { last = i; return i; } } if (v[0] + v[1] != 1) { homerun = true; v[last]++; for (int i=0;i<A;i++) if (v[i]==1) { if (i==last) return -1; else { last = i; return i; } } } if (cnt==4) { homerun = true; for (int i=0;i<A;i++) if (v[i]) track.push_back(i); for (int i=0;i<6;i++) { bool turn = true; for (int j=0;j<5;j++) if (track[j] != a[(i+j)%6]) turn = false; if (turn) return -1; } for (int i=0;i<A;i++) if (v[i]) { last = i; return i; } } for (int i=0;i<A;i++) if (v[i]) { track.push_back(i); last = i; return i; } // cout << "wat" << endl; return 69420; } int move(vector<int> v) { if (last!=-1) v[last]++; if (v[0] + v[1] + v[2]==1) for (int i=0;i<3;i++) if (v[i]) { if (i==last) return -1; else { last = i; return i; } } for (int i=0;i<3;i++) if (v[i] && v[(i+1)%3]) { if (i==last) return -1; else { last = i; return i; } } return 69420; }
#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...