Submission #829755

#TimeUsernameProblemLanguageResultExecution timeMemory
829755BlagojStray Cat (JOI20_stray)C++17
0 / 100
36 ms27564 KiB
#include <bits/stdc++.h> #include "Anthony.h" namespace { int FunctionExample(int i, int A) { return i % A; } } // namespace using namespace std; vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) { vector<int> X(M); queue<pair<int, int>> q; q.push({0, 0}); string s = "001011"; vector<pair<int, int>> g[N + 2]; for (int i = 0; i < M; i++) { g[U[i]].push_back({V[i], i}); g[V[i]].push_back({U[i], i}); } bool visited[N + 2]; memset(visited, 0, sizeof(visited)); visited[0] = 1; while (q.size()) { int cur = q.front().first, clr = q.front().second; q.pop(); for (auto [to, id] : g[cur]) { if (visited[to]) continue; visited[to] = 1; q.push({to, (clr + 1) % 6}); // cout << id << " : " << clr << endl; X[id] = s[clr] - '0'; } } // for (int i = 0; i < X.size(); i++) cout << U[i] << " " << V[i] << " : " << X[i] << endl; return X; }
#include <bits/stdc++.h> #include "Catherine.h" using namespace std; namespace { int A, B; int went; string path; bool wrong; set<string> valid, invalid; vector<string> vl, ivl; } // namespace void Init(int A, int B) { ::A = A; ::B = B; vl = {"11010", "10100", "01001", "10011", "00110", "01101"}; ivl = {"00101", "10010", "11001", "01100", "10110", "01011"}; for (auto x : vl) valid.insert(x); for (auto x : ivl) invalid.insert(x); path = ""; went = 0; wrong = 0; } int Move(vector<int> y) { // cout << path << " " << went << endl; if (went && wrong) { went--; path.pop_back(); return -1; } if (path.size() == 5) { path = path.substr(1); } wrong = 0; vector<pair<int, int>> total; for (int i = 0; i < y.size(); i++) { if (y[i]) total.push_back({y[i], i}); } sort(total.begin(), total.end()); went++; if (total.size() == 1 || total[0] < total[1]) { path += to_string(total[0].second); return total[0].second; } if (path.size() + 1 == 5) { for (int i = 0; i < y.size(); i++) { if (y[i]) { string cur = path + to_string(i); if (invalid.count(cur)) { wrong = 1; went -= 2; path.pop_back(); return -1; } if (valid.count(cur)) { path += to_string(i); return i; } } } } path += to_string(total[0].second); return total[0].second; }

Compilation message (stderr)

Anthony.cpp:6:5: warning: 'int {anonymous}::FunctionExample(int, int)' defined but not used [-Wunused-function]
    6 | int FunctionExample(int i, int A) { return i % A; }
      |     ^~~~~~~~~~~~~~~

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:40:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for (int i = 0; i < y.size(); i++) {
      |                     ~~^~~~~~~~~~
Catherine.cpp:50:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |         for (int i = 0; i < y.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...