Submission #715867

#TimeUsernameProblemLanguageResultExecution timeMemory
715867hpesojStray Cat (JOI20_stray)C++17
0 / 100
33 ms15420 KiB
#include <bits/stdc++.h> #include "Anthony.h" #define pb push_back #define pi pair <int, int> #define fi first #define se second using namespace std; vector <pi> adj[20005]; vector <int> ans; queue <int> q; bool visited[20005]; int curr = -1; //110100110100 int f(int x){ if(x == 0 or x == 1 or x == 3) return 1; else return 0; } void dfs(int x, int p, int c){ if((x == 0 and adj[x].size() >= 2) or adj[x].size() > 2){ curr = -1; int col = (c ? 0 : 1); for(pi i : adj[x]){ if(i.fi == p) continue; ans[i.se] = col; dfs(i.fi, x, col); } } else{ //line if(curr == -1){ if(c == 0) curr = 0; else curr = 1; } for(pi i : adj[x]){ if(i.fi == p) continue; ans[i.se] = f(curr); curr = (curr + 1) % 6; dfs(i.fi, x, f(curr)); } } } 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++) ans.pb(0); for(int i = 0; i < m; i++) adj[u[i]].pb({v[i], i}), adj[v[i]].pb({u[i], i}); dfs(0, -1, 0); return ans; }
#include <bits/stdc++.h> #include "Catherine.h" #define pb push_back #define pi pair <int, int> #define fi first #define se second using namespace std; string seq = "", s[6]; bool correct; int cnt; //110100110100 void Init(int a, int b){ s[0] = "11010"; s[1] = "10100"; s[2] = "01001"; s[3] = "10011"; s[4] = "00110"; s[5] = "01101"; } int Move(std::vector <int> y){ //initial if(cnt == 0){ if(y[0] + y[1] != 2) correct = 1; else{ if(y[0] == 1 and y[1] == 1){ seq.pb('0'), seq.pb('1'); cnt++; return 1; } else if(y[0] == 2){ seq.pb('0'), seq.pb('0'); cnt++; return 0; } else{ seq.pb('1'), seq.pb('1'); cnt++; return 1; } } } if(cnt <= 3 and !correct){ cnt++; if(y[0] + y[1] == 1){ if(y[0] == 1){ seq.pb('0'); return 0; } else{ seq.pb('1'); return 1; } } else{ if(y[0] + y[1] == 0){ correct = 1; return -1; } else if(y[0] == 1){ correct = 1; return 0; } else if(y[1] == 1){ correct = 1; return 1; } else{ correct = 1; return -1; } } } if(cnt > 3 and !correct){ for(int k = 0; k < 6; k++) if(seq == s[k]){ correct = 1; return -1; } correct = 1; } //correct direction if(y[0] + y[1] > 2){ if(y[0] == 1) return 0; else return 1; } else if(y[0] == 1) return 0; else if(y[1] == 1) return 1; }

Compilation message (stderr)

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:88:1: warning: control reaches end of non-void function [-Wreturn-type]
   88 | }
      | ^
#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...