Submission #924403

#TimeUsernameProblemLanguageResultExecution timeMemory
924403socpiteStray Cat (JOI20_stray)C++14
76 / 100
37 ms14716 KiB
#include "Anthony.h" #include<bits/stdc++.h> using namespace std; namespace { const int maxn = 2e4+5; vector<pair<int, int>> g[maxn]; array<int, 6> pattern = {1, 0, 1, 0, 0, 1}; int pos[maxn]; vector<int> ans; void dfs(int x, int p){ // cout << x << endl; int cc = 0; for(auto v: g[x]){ if(v.second == p)continue; cc++; } if(cc == 1){ // only child for(auto v: g[x]){ if(v.second == p)continue; ans[v.second] = pattern[pos[x]]; pos[v.first] = (pos[x]+1)%6; dfs(v.first, v.second); } } else { for(auto v: g[x]){ if(v.second == p)continue; ans[v.second] = p == -1 ? 0 : ans[p]^1; pos[v.first] = ans[v.second] ? 1 : 2; dfs(v.first, v.second); } } } } // namespace std::vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) { assert(A == 2); ans.resize(M); for(int i = 0; i < M; i++){ g[U[i]].push_back({V[i], i}); g[V[i]].push_back({U[i], i}); } for(int i = 0; i < N; i++){ pos[i] = 0; } dfs(0, -1); // for(auto v: ans)cout << v << " "; // cout << endl; return ans; }
#include "Catherine.h" #include<bits/stdc++.h> using namespace std; //1001 namespace { int A, B; int variable_example = 0; int start = 1; int on_line = 0; int prv = 0; int ptr = 0; set<array<int, 6>> check = { {1, 0, 1, 0, 0, 1}, {0, 1, 0, 0, 1, 1}, {1, 0, 0, 1, 1, 0}, {0, 0, 1, 1, 0, 1}, {0, 1, 1, 0, 1, 0}, {1, 1, 0, 1, 0, 0} }; array<int, 6> crr; } // namespace void Init(int A, int B) { ::A = A; ::B = B; } // MAX: <; MIN: > int Move(std::vector<int> y) { if(A == 2){ if(start){ start = 0; if(y[0] + y[1] != 2){ if(min(y[0], y[1]) == 0)prv = y[0] < y[1]; else prv = y[0] > y[1]; return prv; } else { on_line = 1; prv = y[0] < y[1]; // cout << prv << endl; crr[ptr++] = prv; return prv; } } else{ if(!on_line){ if(ptr){ ptr = 0; return -1; } else { if(min(y[0], y[1]) == 0)prv = y[0] < y[1]; else prv^=1; return prv; } } else { if(y[0] + y[1] != 1){ on_line = 0; ptr = 0; if(min(y[0], y[1]) == 0)return -1; else { prv^=1; return prv; } } else{ prv = y[0] < y[1]; crr[ptr++] = prv; if(ptr == 6){ on_line = 0; if(check.find(crr) == check.end())ptr = 0; } // cout << prv << endl; return prv; } } } } return 0; }

Compilation message (stderr)

Catherine.cpp:9:8: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 |    int variable_example = 0;
      |        ^~~~~~~~~~~~~~~~
#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...