# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
388310 |
2021-04-10T21:51:48 Z |
ngrace |
Stray Cat (JOI20_stray) |
C++14 |
|
61 ms |
16168 KB |
#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
int FunctionExample(int i, int A) {
return i % A;
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
std::vector<int> X(M,-1);
vector<vector<pair<int,int>>> adj(N,vector<pair<int,int>>(0));//node,index of road
for(int i=0;i<M;i++){
adj[U[i]].push_back({V[i],i});
adj[V[i]].push_back({U[i],i});
}
if(A==4 || (A==3 && M==N-1)){
vector<int> dists(N,-1);
dists[0]=0;
queue<int> q;
q.push(0);
while(q.size()>0){
int cur=q.front();
q.pop();
for(pair<int,int>& it:adj[cur]){
if(dists[it.first]==-1){
dists[it.first]=dists[cur]+1;
X[it.second]=dists[cur]%3;
q.push(it.first);
}
}
}
for(int i=0;i<M;i++){
if(X[i]==-1){
vector<int> cur(3,0);
vector<int> cur1(3,0);
for(pair<int,int>& it:adj[U[i]]){
if(X[it.second]!=-1){
cur[X[it.second]]=1;
}
}
for(pair<int,int>& it:adj[V[i]]){
if(X[it.second]!=-1){
cur1[X[it.second]]=1;
}
}
vector<int> a = cur;
for(int i=0;i<3;i++){
if(cur1[i]==1){
a[i]++;
}
}
if(a[0]>0 && a[1]>0 && a[2]>0){
X[i]=1;
}
if(a[0]==0){
X[i]=2;
}
if(a[1]==0){
X[i]=0;
}
if(a[2]==0){
X[i]==1;
if(a[0]==0){
X[i]=2;
}
}
}
}
}
return X;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int A, B, out;
int variable_example = 0;
vector<int> cur;
vector<int> pastMoves;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(std::vector<int> y) {
out=0;
cur = vector<int>(4,0);
if(A==4 || A==3){
if(pastMoves.size()>0){
y[pastMoves.back()]++;
}
for(int i=0;i<y.size();i++){
if(y[i]>0){
cur[i]=1;
}
}
if(cur[0]==1 && cur[1]==1){
out=0;
}
else if(cur[1]==1&&cur[2]==1){
out=1;
}
else if(cur[2]==1&&cur[0]==1){
out=2;
}
else if(cur[0]==1){
out=0;
}
else if(cur[1]==1){
out=1;
}
else{
out=2;
}
}
pastMoves.push_back(out);
return out;
}
Compilation message
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:73:15: warning: value computed is not used [-Wunused-value]
73 | X[i]==1;
Anthony.cpp: At global scope:
Anthony.cpp:7:5: warning: 'int {anonymous}::FunctionExample(int, int)' defined but not used [-Wunused-function]
7 | int FunctionExample(int i, int A) {
| ^~~~~~~~~~~~~~~
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int i=0;i<y.size();i++){
| ~^~~~~~~~~
Catherine.cpp: At global scope:
Catherine.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
7 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
15108 KB |
Output is correct |
2 |
Correct |
0 ms |
496 KB |
Output is correct |
3 |
Correct |
45 ms |
14440 KB |
Output is correct |
4 |
Correct |
56 ms |
16124 KB |
Output is correct |
5 |
Correct |
61 ms |
16168 KB |
Output is correct |
6 |
Correct |
46 ms |
14880 KB |
Output is correct |
7 |
Correct |
43 ms |
14728 KB |
Output is correct |
8 |
Correct |
49 ms |
15512 KB |
Output is correct |
9 |
Correct |
54 ms |
15488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
15108 KB |
Output is correct |
2 |
Correct |
0 ms |
496 KB |
Output is correct |
3 |
Correct |
45 ms |
14440 KB |
Output is correct |
4 |
Correct |
56 ms |
16124 KB |
Output is correct |
5 |
Correct |
61 ms |
16168 KB |
Output is correct |
6 |
Correct |
46 ms |
14880 KB |
Output is correct |
7 |
Correct |
43 ms |
14728 KB |
Output is correct |
8 |
Correct |
49 ms |
15512 KB |
Output is correct |
9 |
Correct |
54 ms |
15488 KB |
Output is correct |
10 |
Incorrect |
13 ms |
2048 KB |
Wrong Answer [2] |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
12544 KB |
Output is correct |
2 |
Correct |
0 ms |
496 KB |
Output is correct |
3 |
Correct |
39 ms |
12144 KB |
Output is correct |
4 |
Correct |
52 ms |
13976 KB |
Output is correct |
5 |
Correct |
51 ms |
13988 KB |
Output is correct |
6 |
Correct |
42 ms |
12780 KB |
Output is correct |
7 |
Correct |
42 ms |
12536 KB |
Output is correct |
8 |
Correct |
47 ms |
13320 KB |
Output is correct |
9 |
Correct |
48 ms |
13304 KB |
Output is correct |
10 |
Correct |
49 ms |
13064 KB |
Output is correct |
11 |
Correct |
48 ms |
13096 KB |
Output is correct |
12 |
Correct |
45 ms |
13096 KB |
Output is correct |
13 |
Correct |
46 ms |
13132 KB |
Output is correct |
14 |
Correct |
48 ms |
13276 KB |
Output is correct |
15 |
Correct |
48 ms |
13356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
12544 KB |
Output is correct |
2 |
Correct |
0 ms |
496 KB |
Output is correct |
3 |
Correct |
39 ms |
12144 KB |
Output is correct |
4 |
Correct |
52 ms |
13976 KB |
Output is correct |
5 |
Correct |
51 ms |
13988 KB |
Output is correct |
6 |
Correct |
42 ms |
12780 KB |
Output is correct |
7 |
Correct |
42 ms |
12536 KB |
Output is correct |
8 |
Correct |
47 ms |
13320 KB |
Output is correct |
9 |
Correct |
48 ms |
13304 KB |
Output is correct |
10 |
Correct |
49 ms |
13064 KB |
Output is correct |
11 |
Correct |
48 ms |
13096 KB |
Output is correct |
12 |
Correct |
45 ms |
13096 KB |
Output is correct |
13 |
Correct |
46 ms |
13132 KB |
Output is correct |
14 |
Correct |
48 ms |
13276 KB |
Output is correct |
15 |
Correct |
48 ms |
13356 KB |
Output is correct |
16 |
Incorrect |
8 ms |
2040 KB |
Wrong Answer [2] |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
496 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
2156 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
2176 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |