Submission #1012834

#TimeUsernameProblemLanguageResultExecution timeMemory
1012834Ivo_12Stray Cat (JOI20_stray)C++17
15 / 100
45 ms17024 KiB
#include "Anthony.h" #include <bits/stdc++.h> #define ll long long #define mp make_pair #define pb push_back #define F first #define S second #define pii pair < int, int > #define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; namespace { const int N = 2e4+10, M = 2e4+10, A = 4; vector < pii > edges[N]; vector < int > oznake; int dis[N]; queue < int > q; vector < int > mark( int n, int m, int a, int b, vector < int > t1, vector < int > t2 ) { for(int i = 0; i < m; i++) { edges[t1[i]].pb(mp(t2[i], i)); edges[t2[i]].pb(mp(t1[i], i)); oznake.pb(-1); } dis[0] = 1; q.push(0); int cur; int sus; while(!q.empty()) { cur = q.front(); q.pop(); for(int i = 0; i < (int) edges[cur].size(); i++) { sus = edges[cur][i].F; if(dis[sus] == 0) { q.push(sus); dis[sus] = dis[cur]+1; } } } if(a>=3) { q.push(0); while(!q.empty()) { cur = q.front(); q.pop(); for(int i = 0; i < (int) edges[cur].size(); i++) { sus = edges[cur][i].F; if(oznake[edges[cur][i].S] == -1) { if(dis[sus] > dis[cur]) q.push(sus); oznake[edges[cur][i].S] = (dis[cur] - 1) % 3; } } } } else { q.push(0); while(!q.empty()) { cur = q.front(); q.pop(); for(int i = 0; i < (int) edges[cur].size(); i++) { sus = edges[cur][i].F; if(oznake[edges[cur][i].S] == -1) { if(dis[sus] > dis[cur]) q.push(sus); oznake[edges[cur][i].S] = (dis[cur] - 1) % 2; } } } } return oznake; } } // namespace std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) { std::vector<int> X(M); return ::mark(N, M, A, B, U, V); }
#include "Catherine.h" #include <bits/stdc++.h> #define ll long long #define mp make_pair #define pb push_back #define F first #define S second #define pii pair < int, int > #define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; namespace { int ga, gb; int l[2]; void init( int a, int b ) { ga = a; gb = b; l[0] = 0; l[1] = 0; } int move( vector < int > v ) { if(::ga>=3) { if(v[0] && v[1]) return 0; if(v[2] && v[0]) return 2; if(v[1] && v[2]) return 1; if(!(v[0] || v[1])) return 2; if(!(v[2] || v[0])) return 1; if(!(v[1] || v[2])) return 0; } if(v[0] == 0 && v[1] == 0) return -1; if(v[0] == 0 && v[1] > 1) { return -1; } if(v[0] > 1 && v[1] == 0) { return -1; } if(l[0]) { l[1] = 1; l[0] = 0; return 1; } if(l[1]) { l[1] = 0; l[0] = 1; return 0; } if(v[0] > v[1]) { l[1] = 1; l[0] = 0; return 1; } l[1] = 0; l[0] = 1; return 0; } } // namespace void Init(int A, int B) { ::init(A, B); } int Move(std::vector<int> y) { return ::move(y); }
#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...