# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
829697 |
2023-08-18T14:12:15 Z |
MODDI |
Stray Cat (JOI20_stray) |
C++14 |
|
37 ms |
27392 KB |
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
namespace {
} // namespace
std::vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
vi arr(M, -1);
vector<vector<pii>> G(N, vector<pii>());
for(int i = 0; i < M; i++){
int u = U[i], v = V[i];
G[u].pb({v, i});
G[v].pb({u, i});
}
vi dist(N, N);
dist[0] = 0;
queue<int> q;
q.push(0);
while(!q.empty()){
int v = q.front();
q.pop();
for(pii next : G[v]){
if(dist[next.first] == N){
dist[next.first] = 1 + dist[v];
q.push(next.first);
}
}
}
if(A >= 3){
for(int i = 0; i < M; i++){
arr[i] = min(dist[U[i]], dist[V[i]]) % 3;
}
return arr;
}
// else{
// assert(false);
// vi pib(N, -1);
// for(int i = 0; i < N; i++){
// int v = ord[i];
// if(i == 0){
// for(auto t : G[v]){
// arr[t.second] = 0;
// }
// continue;
// }
// int deg = (int) G[v].size();
// if(deg == 1) continue;
// int par = -1, parC = -1;
// for(auto t : G[v]){
// if(dist[t.first] < dist[v]){
// par = t.first;
// parC = arr[t.second];
// }
// }
// if(deg == 2){
// if(pib[par] != -1){
// pib[v] = (pib[par] + 1) % 6;
// }
// else
// pib[v] = parC + 1;
// int col = (pib[v] == 0 || pib[v] == 2 || pib[v] == 3 ? 0 : 1);
// for(auto t : G[v]){
// if(t.first != par)
// arr[t.second] = col;
// }
// }
// else{
// for(auto t : G[v]){
// if(t.first != par)
// arr[t.second] = parC ^ 1;
// }
// }
//
// }
// }
return arr;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
namespace {
int A;
bool bP;
vector<int> colors;
bool Uping(vector<int> s) {
vector<int> t = {1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0};
// reverse(t.begin(), t.end());
for (int i = 0; i + (int)s.size() <= (int)t.size(); i++) {
bool ok = true;
for (int j = 0; j < (int)s.size(); j++)
ok &= s[j] == t[i + j];
if (ok) return true;
}
return false;
}
} // namespace
void Init(int A, int B) {
A = A;
bP = true;
colors = vector<int>();
}
int Move(std::vector<int> y) {
if (A > 2) {
int c = 0;
while(c < 3) {
if (y[c] > 0 && y[(c + 2) % 3] == 0) break;
c++;
}
return c;
}
// else{
// assert(false);
// if(!colors.empty()) y[colors.back()]++;
// int deg = y[0] + y[1], col = -2;
// if(deg == 1){
// bP = false;
// if(colors.empty()) col = (y[0] > 0 ? 0 : 1);
// else col = -1;
// }
// else if (deg == 2) {
// if (!bP) {
// y[colors.back()]--;
// col = (y[0] > 0 ? 0 : 1);
// }
// else {
// if ((int)colors.size() < 4) {
// if (!colors.empty()) y[colors.back()]--;
// col = (y[0] > 0 ? 0 : 1);
// if (colors.empty()) {
// y[col]--;
// colors.push_back((y[0] > 0 ? 0 : 1));
// }
// }
// else {
// y[colors.back()]--;
// col = (y[0] > 0 ? 0 : 1);
// vector<int> s = colors;
// s.push_back(col);
// if (!Uping(s)) col = -1;
// bP = false;
// }
// }
// }
// else {
// bP = false;
// col = (y[0] == 1 ? 0 : 1);
// if (!colors.empty() && colors.back() == col) col = -1;
// }
// if (col == -1) {
// int x = colors.back();
// colors.push_back(x);
// } else {
// colors.push_back(col);
// }
// return col;
// }
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:92:1: warning: control reaches end of non-void function [-Wreturn-type]
92 | }
| ^
Catherine.cpp: At global scope:
Catherine.cpp:17:6: warning: 'bool {anonymous}::Uping(std::vector<int>)' defined but not used [-Wunused-function]
17 | bool Uping(vector<int> s) {
| ^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
37 ms |
27392 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
37 ms |
27392 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
28 ms |
22932 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
28 ms |
22932 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
644 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
2312 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
2316 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |