Submission #674332

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6743322022-12-23 17:41:48null_aweStray Cat (JOI20_stray)C++14
100 / 100
51 ms16484 KiB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
vector<int> Mark(int n, int m, int a, int b, vector<int> u, vector<int> v) {
vector<vector<pii>> adj(n);
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 == 2) {
vector<int> color(m, -1), dist(n, -1), lp(n), llp(n);
for (int i = 0; i < n; ++i) lp[i] = i, llp[i] = i;
queue<int> q; q.push(0), dist[0] = 0;
set<int> heads;
while (q.size()) {
int v = q.front(); q.pop();
int label = dist[v] % 2;
for (const auto& [u, i] : adj[v]) {
if (color[i] >= 0) {
if (adj[v].size() == 2) {
lp[v] = lp[u];
if (lp[u] == u) heads.insert(v);
else llp[v] = llp[u];
}
continue;
}
color[i] = label;
q.push(u), dist[u] = dist[v] + 1;
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:18:24: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   18 |       for (const auto& [u, i] : adj[v]) {
      |                        ^
Anthony.cpp:37:26: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   37 |         for (const auto& [u, i] : adj[cur]) {
      |                          ^
Anthony.cpp:42:33: warning: unused variable 'v2' [-Wunused-variable]
   42 |       int v1 = dist[lp[p]] % 2, v2 = dist[cur] % 2;
      |                                 ^~
Anthony.cpp:57:24: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   57 |       for (const auto& [u, i] : adj[v]) {
      |                        ^
Anthony.cpp:70:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   70 |     for (const auto& [u, i] : adj[v]) {
      |                      ^

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:28:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for (int i = 0; i < copy.size(); ++i)
      |                   ~~^~~~~~~~~~~~~
Catherine.cpp:35:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |       for (int i = 0; i < y.size(); ++i) {
      |                       ~~^~~~~~~~~~
Catherine.cpp:49:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         if (sum == 0 || sum == y.size()) {
      |                         ~~~~^~~~~~~~~~~
Catherine.cpp:55:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |           for (int i = 0; i < y.size(); ++i) {
      |                           ~~^~~~~~~~~~
Catherine.cpp:63:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |         for (int i = 0; i < y.size(); ++i) {
      |                         ~~^~~~~~~~~~
Catherine.cpp:90:46: warning: comparison of integer expressions of different signedness: 'const int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   90 |   if (max(count[0], max(count[1], count[2])) == y.size()) return y[0];
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
#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...