Submission #978750

#TimeUsernameProblemLanguageResultExecution timeMemory
978750andrei_iorgulescuStray Cat (JOI20_stray)C++14
20 / 100
41 ms16860 KiB
#include "Anthony.h" #include <bits/stdc++.h> using namespace std; int n,m,AA,BB; vector<int> g[20005]; vector<pair<int,int>> e; vector<int> d; void bfs() { d.resize(n); for (int i = 0; i < n; i++) d[i] = 1e9; d[0] = 0; queue<int> q; q.push(0); while (!q.empty()) { int nod = q.front(); q.pop(); for (auto vecin : g[nod]) { if (d[vecin] == 1e9) { d[vecin] = 1 + d[nod]; q.push(vecin); } } } } vector<int> ant1() { bfs(); vector<int> ans(m); for (int i = 0; i < e.size(); i++) { int x = e[i].first,y = e[i].second; ans[i] = min(d[x],d[y]) % 3; } return ans; } vector<int> ant2() { bfs(); vector<int> ans(m); for (int i = 0; i < e.size(); i++) { int x = e[i].first,y = e[i].second; ans[i] = min(d[x],d[y]) % 2; } return ans; } vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) { n = N,m = M; AA = A,BB = B; for (int i = 0; i < m; i++) { g[U[i]].push_back(V[i]); g[V[i]].push_back(U[i]); e.push_back({U[i],V[i]}); } if (A >= 3) return ant1(); else return ant2(); }
#include "Catherine.h" #include <bits/stdc++.h> using namespace std; int A1,B1; void Init(int A, int B) { A1 = A; B1 = B; } int cat1(vector<int> y) { if (y[0] == 0 and y[1] == 0) return 2; if (y[1] == 0 and y[2] == 0) return 0; if (y[0] == 0 and y[2] == 0) return 1; if (y[2] == 0) return 0; if (y[0] == 0) return 1; return 2; } int lastcul = -1; bool gogo = false; int cat2(vector<int> y) { if (gogo == true) { lastcul = 1 - lastcul; return lastcul; } if (lastcul == -1) { if (y[0] + y[1] >= 3) { if (y[0] == 1) { gogo = true; lastcul = 0; return lastcul; } else { gogo = true; lastcul = 1; return lastcul; } } else if (y[0] + y[1] == 1) { gogo = true; if (y[0] == 1) lastcul = 0; else lastcul = 1; return lastcul; } else { lastcul = 0; return lastcul; } } else { if (y[0] + y[1] == 0) { gogo = true; return -1; } else if (y[0] + y[1] >= 2) { if (y[0] == 0 or y[1] == 0) { gogo = true; return -1; } else { lastcul = 1 - lastcul; gogo = true; return lastcul; } } else { lastcul = 1 - lastcul; return lastcul; } } } int Move(vector<int> y) { if (A1 >= 3) return cat1(y); else return cat2(y); }

Compilation message (stderr)

Anthony.cpp: In function 'std::vector<int> ant1()':
Anthony.cpp:38:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (int i = 0; i < e.size(); i++)
      |                     ~~^~~~~~~~~~
Anthony.cpp: In function 'std::vector<int> ant2()':
Anthony.cpp:50:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     for (int i = 0; i < e.size(); i++)
      |                     ~~^~~~~~~~~~
#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...