Submission #1180187

#TimeUsernameProblemLanguageResultExecution timeMemory
1180187PlayVoltzStray Cat (JOI20_stray)C++20
Compilation error
0 ms0 KiB
#include "Anthony.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second vector<int> Mark(int n, int m, int A, int B, vector<int> u, vector<int> v){ vector<vector<int> > graph(n); vector<int> res(m, -1), a, vect(n, -1); for (int i=0; i<m; ++i){ graph[u[i]].pb(i); graph[v[i]].pb(i); } if (A>2)a={0, 1, 2}; else a={0, 1, 0, 0, 1, 1}; queue<int> q; vect[0]=0; q.push(0); while (q.size()){ int node=q.front(); q.pop(); for (auto a:graph[node]){ int num=u[a]^v[a]^node; if (res[a]==-1)res[a]=a[vect[node]]; if (vect[num]==-1){ if (graph[num].size()>2&&A==2)vect[num]=!a[vect[node]]; else vect[num]=(vect[node]+1)%a.size(); q.push(num); } } } return res; }
#include "Catherine.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second namespace{ int A, B, prev; bool lost; string s, a="010011010011"; } void Init(int a, int b){ A=a, B=b; prev=-1; lost=1; s=""; } int Move(vector<int> vect){ if (A>2){ if (!vect[0])return (vect[1]?1:2); if (!vect[1])return (vect[2]?2:0); return (vect[0]?0:1); } if (vect[0]+vect[1]>2){ lost=0; if (prev==-1)return prev=(vect[1]==1); if (!vect[prev])return -1; return prev=!prev; } else if (vect[0]+vect[1]==1){ lost=0; if (prev==-1)return prev=vect[1]; return -1; } else if (!lost)return prev=vect[1]; else{ for (int i=0; i<vect[0].size(); ++i)s.pb('0'); for (int i=0; i<vect[1].size(); ++i)s.pb('1'); if (s.size()==5){ lost=0; for (int i=0; i<6; ++i)if (s==a.substr(i, 5))return -1; } if (vect[0]&&vect[1])return prev=1; return prev=!!vect[1]; } }

Compilation message (stderr)

# 1번째 컴파일 단계

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:28:48: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   28 |                         if (res[a]==-1)res[a]=a[vect[node]];
      |                                                ^
Anthony.cpp:30:75: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   30 |                                 if (graph[num].size()>2&&A==2)vect[num]=!a[vect[node]];
      |                                                                           ^
Anthony.cpp:31:65: error: request for member 'size' in 'a', which is of non-class type 'int'
   31 |                                 else vect[num]=(vect[node]+1)%a.size();
      |                                                                 ^~~~