This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> haha[200001];
std::vector<int> Mark(int n, int m, int a, int b, std::vector<int> u, std::vector<int> v) {
for(int i = 0; i < m; i++) {
haha[u[i]].push_back({v[i],i});
haha[v[i]].push_back({u[i],i});
}
vector<int> br(n,INT_MAX);
br[0] = 0;
queue<int> idk;
idk.push(0);
vector<int> ans(m,-1);
while(!idk.empty()) {
int u = idk.front();
idk.pop();
for(pair<int,int> v: haha[u]) {
if(br[v.first] == INT_MAX) {
br[v.first] = br[u]+1;
ans[v.second] = br[u]%3;
idk.push(v.first);
}
}
}
for(int i = 0; i < m; i++) {
if(ans[i] == -1) {
int c = max(br[u[i]],br[v[i]])%3;
ans[i] = c;
}
}
return ans;
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;
void Init(int a, int b) {
return;
}
int Move(vector<int> haha) {
vector<int> wow(0);
for(int i = 0; i < haha.size(); i++) {
if(haha[i] == 1) {
wow.push_back(i);
}
}
if(wow.size() == 1) {
return wow[0];
}
else if(wow.size() == 2) {
if(wow[0] == 0 && wow[1] == 1) {
return 0;
}
else if(wow[0] == 1 && wow[1] == 2) {
return 1;
}
else {
return 2;
}
}
}
Compilation message (stderr)
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:11:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
11 | for(int i = 0; i < haha.size(); i++) {
| ~~^~~~~~~~~~~~~
Catherine.cpp:10:22: warning: control reaches end of non-void function [-Wreturn-type]
10 | vector<int> wow(0);
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |