Submission #829788

# Submission time Handle Problem Language Result Execution time Memory
829788 2023-08-18T15:02:09 Z Blagoj Stray Cat (JOI20_stray) C++17
0 / 100
28 ms 14916 KB
#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;
int last;
}  // 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;
    last = -1;
}

int Move(vector<int> y) {
    // cout << path << " " << went << endl;
    if (went && wrong) {
        went--;
        last = path.back() - '0';
        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});
    }
    if (total.size() == 0) {
        went--;
        path.pop_back();
        return -1;
    }
    sort(total.begin(), total.end());
    if (total[0].second == last) total[0].first++;
    if (total[1].second == last) total[0].first++;
    went++;
    if (total.size() == 1 || total[0].first < total[1].first) {
        path += to_string(total[0].second);
        last = 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);
                    last = i;
                    return i;
                }
            }
        }
    }
    path += to_string(total[0].second);
    last = total[0].second;
    return total[0].second;
}

Compilation message

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:43:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for (int i = 0; i < y.size(); i++) {
      |                     ~~^~~~~~~~~~
Catherine.cpp:61:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |         for (int i = 0; i < y.size(); i++) {
      |                         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 14916 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 14916 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 12684 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 12684 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 900 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 11008 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 11108 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -